39 lines
1.3 KiB
Diff
39 lines
1.3 KiB
Diff
|
|
From 37ca44107dce240f45ccf33e8fb59b5c6702abb9 Mon Sep 17 00:00:00 2001
|
||
|
|
From: Nathanael Demacon <7271496+quantumsheep@users.noreply.github.com>
|
||
|
|
Date: Sat, 1 Mar 2025 16:26:24 +0100
|
||
|
|
Subject: [PATCH] Escape double quotes in graphviz labels (#235)
|
||
|
|
|
||
|
|
* escape double quotes in graphviz labels
|
||
|
|
|
||
|
|
Signed-off-by: Nathanael DEMACON <quantumsheep@users.noreply.github.com>
|
||
|
|
|
||
|
|
* rename the variable label
|
||
|
|
|
||
|
|
Signed-off-by: Nathanael DEMACON <quantumsheep@users.noreply.github.com>
|
||
|
|
|
||
|
|
---------
|
||
|
|
|
||
|
|
Signed-off-by: Nathanael DEMACON <quantumsheep@users.noreply.github.com>
|
||
|
|
Co-authored-by: Nathanael DEMACON <quantumsheep@users.noreply.github.com>
|
||
|
|
---
|
||
|
|
treelib/tree.py | 3 ++-
|
||
|
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
||
|
|
|
||
|
|
diff --git a/treelib/tree.py b/treelib/tree.py
|
||
|
|
index 1cc9ac8..7bc4e7e 100644
|
||
|
|
--- a/treelib/tree.py
|
||
|
|
+++ b/treelib/tree.py
|
||
|
|
@@ -1097,7 +1097,8 @@ class Tree(object):
|
||
|
|
sorting=sorting,
|
||
|
|
):
|
||
|
|
nid = self[n].identifier
|
||
|
|
- state = '"{0}" [label="{1}", shape={2}]'.format(nid, self[n].tag, shape)
|
||
|
|
+ label = str(self[n].tag).translate(str.maketrans({'"': r"\""}))
|
||
|
|
+ state = '"{0}" [label="{1}", shape={2}]'.format(nid, label, shape)
|
||
|
|
nodes.append(state)
|
||
|
|
|
||
|
|
for c in self.children(nid):
|
||
|
|
--
|
||
|
|
2.33.0
|
||
|
|
|