]> ruderich.org/simon Gitweb - linux-network-namespace-labs/linux-network-namespace-labs.git/commitdiff
dot: quote nodes in dotlang to allow for special chars
authorLuca <luca@daerich.com>
Thu, 24 Apr 2025 18:56:52 +0000 (20:56 +0200)
committerSimon Ruderich <simon@ruderich.org>
Wed, 30 Apr 2025 08:10:17 +0000 (10:10 +0200)
[sr: replace "\"%s\"" with "%q", don't escape in HTML label which causes
extra quotes]

Signed-off-by: Luca <luca@daerich.com>
dot.go

diff --git a/dot.go b/dot.go
index 8ed8df9928feb767116c418d25b3b87715d4ddb8..c0f058ed9211422a85719fb4245e74a233378836 100644 (file)
--- a/dot.go
+++ b/dot.go
@@ -31,7 +31,7 @@ func writeDot(cfg *Config, path string) error {
                        as = append(as, fmt.Sprintf("&nbsp;<font point-size=\"10\">%s</font>&nbsp;<br/>",
                                html.EscapeString(x.String())))
                }
-               fmt.Fprintf(w, "%s [label=<%s>]\n",
+               fmt.Fprintf(w, "%q [label=<%s>]\n",
                        node.Name, strings.Join(as, ""))
        }
 
@@ -46,7 +46,7 @@ func writeDot(cfg *Config, path string) error {
                        abs = append(abs, fmt.Sprintf("&nbsp;%s&nbsp;<br/>",
                                html.EscapeString(x.Addr().String())))
                }
-               fmt.Fprintf(w, "%s -- %s [taillabel=<%s>,headlabel=<%s>,labelfontsize=10]\n",
+               fmt.Fprintf(w, "%q -- %q [taillabel=<%s>,headlabel=<%s>,labelfontsize=10]\n",
                        link.A.Node.Name, link.B.Node.Name,
                        strings.Join(aas, ""), strings.Join(abs, ""))
        }