can't restore the grapth from svg source code

0 votes
asked Apr 29, 2019 in Bug by seekerYb (120 points)

I use plantuml on the online demo server: http://www.plantuml.com/plantuml/uml/  version 1201905 

@startuml
class A 
A <|-- B
@enduml

this piece of plantuml code work well and can successfully generate a svg file. But when I want to edit the uml . I may open the source code of the svg file and find the origin plantuml code. In the end of the file the code would be like this:

@startuml
class A 
A <|- - B
@enduml

 

a redundant space appear between the two dashes,which cause a syntax error. When the whole graph is complex, I must delete all the redundant space manually.I'm looking forward to your reply.

1 Answer

0 votes
answered Apr 29, 2019 by plantuml (295,000 points)
selected Apr 30, 2019 by seekerYb
 
Best answer
The main issue is that the diagram code is put into a svg comment. Separator for SVG comment are <!-- and --> so spaces are added to prevent clash between the diagram definition itself and the SVG comment separators.

We cannot do much about this. Any suggestion is welcome !
commented Apr 30, 2019 by albert (3,520 points)
I'm thinking about 2 possibilities:
- CDATA
- encode the XML special characters i.e. &, ", ', <, > by their escaped versions: &amp;, &quot;, &apos;, &lt;, &gt;  in the comment.
commented May 11, 2020 by coxley
Got it! Then I feel safe using string substitution; "- -" to "--". If changing at this point is hard for backward compatibility, documenting this is good enough for me.
...