diff options
author | Timotej Lazar <timotej.lazar@araneo.org> | 2015-08-24 12:38:56 +0200 |
---|---|---|
committer | Timotej Lazar <timotej.lazar@araneo.org> | 2015-08-24 12:38:56 +0200 |
commit | a20f9b8842c6da6631ae36f62571394053b5c082 (patch) | |
tree | 42c958c58eaa67d3436a9d29aa26a387827a59d7 /monkey | |
parent | d9c8ca8f64839128d2fd3ae04a19ba73c1125b7b (diff) |
monkey.graph.graphviz: fix escaping of node labels
Diffstat (limited to 'monkey')
-rw-r--r-- | monkey/graph.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/monkey/graph.py b/monkey/graph.py index 20a8a98..a8ad4b0 100644 --- a/monkey/graph.py +++ b/monkey/graph.py @@ -50,7 +50,8 @@ def graphviz(nodes, label=str, pos=None, node_attr=None, edge_attr=None): gv_nodes = {} for node in nodes: gv_nodes[id(node)] = len(gv_nodes) - node_str += '\t{} [label="{}"'.format(gv_nodes[id(node)], label(node).replace('"', '\\"')) + node_label = label(node).replace('\\', '\\\\').replace('"', '\\"') + node_str += '\t{} [label="{}"'.format(gv_nodes[id(node)], node_label) if pos: node_str += ', ' + 'pos="{},{}"'.format(*pos(node)) if node_attr: |