-
Notifications
You must be signed in to change notification settings - Fork 565
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rd2dot Escape HTML in node label and URI text #1209
rd2dot Escape HTML in node label and URI text #1209
Conversation
Open Close Travis |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. The Travis test failure is due only to connection issues in Travis, not anything from the code changes so I approve. Awaiting second review.
Actually now I tried to reproduce your example from #1208 resp. my version #1208 (comment) and I get:
the result is:
so there is still an unescaped & |
Maybe it would be good to have the example as test |
I think I did't acutally test the fixed version, now I did bot got the following error an result:
|
For me it is not very clear, how actually an @blake-regalia and @nicholascar what was the output of your tests? |
Hmm, yes it seems that the href attribute value should also be escaped:
https://graphviz.org/doc/info/shapes.html#html But it seems no matter what I do, the DOT parsers cannot tolerate an ampersand in the href value whether or not it is in an HTML escape sequence For reference, here is the complete self-contained minimum example snippet: import io
from rdflib import URIRef, Literal
from rdflib.namespace import DC
subj = URIRef('eg://org/?foo=bar&baz=bux')
pred = URIRef('eg://org/predicate')
obj = URIRef('eg://org/object')
g = rdflib.Graph()
g.add((subj, pred, obj))
g.add((subj, DC.title, Literal('This & That')))
out = io.StringIO()
rdf2dot(g, out)
print(out.getvalue()) |
Fixes #1208
Proposed Changes