Skip to content

invalid svg produced from AbsDiagramItem #1

Description

@pvanek

SVG sections are missing space between attributes sometimes. It results in invalid SVG syntax so other tools like eg. ImageMagick, Inkscape, or any online checker or converter complain about it.

Fix as a "works for me" solution:

index 5c5a2b6..7ef7ba3 100644
--- a/src/main/kotlin/com/cjsoftware/antlr4docgen/railroad/diagramitem/AbsDiagramItem.kt
+++ b/src/main/kotlin/com/cjsoftware/antlr4docgen/railroad/diagramitem/AbsDiagramItem.kt
@@ -71,7 +71,7 @@ internal abstract class AbsDiagramItem(val alignment: Alignment, val styleClass:
         StringBuilder().apply {
             append("<rect ")
             append("x=${quotVal(x)} y=${quotVal(y)} ")
-            append("width=${quotVal(w)} height=${quotVal(h)}")
+            append("width=${quotVal(w)} height=${quotVal(h)} ")
             if (svgClass.isNotBlank()) append("class=${quotVal(svgClass)} ")
             append("/>")
         }.toString()
@@ -80,8 +80,8 @@ internal abstract class AbsDiagramItem(val alignment: Alignment, val styleClass:
         StringBuilder().apply {
             append("<rect ")
             append("x=${quotVal(x)} y=${quotVal(y)} ")
-            append("width=${quotVal(w)} height=${quotVal(h)}")
-            append("rx=${quotVal((h / 2f) - 1f)}")
+            append("width=${quotVal(w)} height=${quotVal(h)} ")
+            append("rx=${quotVal((h / 2f) - 1f)} ")
             if (svgClass.isNotBlank() == true) append("class=${quotVal(svgClass)} ")
             append("/>")
         }.toString()

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions