From 4d8ffbb3a788404b8ed15d0558a312e5b821b825 Mon Sep 17 00:00:00 2001 From: Adrien Di Mascio Date: Thu, 3 May 2007 12:56:13 +0200 Subject: fix escape for DOT node ids. The doc says : ... node_id : ID [ port ] ... and later: An ID is one of the following: - Any string of alphabetic characters, underscores or digits, not beginning with a digit; - a number [-]?(.[0-9]+ | [0-9]+(.[0-9]*)? ); - any double-quoted string ("...") possibly containing escaped quotes (\"); - an HTML string (<...>). so just quoting the node id seems enough --- graph.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'graph.py') diff --git a/graph.py b/graph.py index 05f16c1..3ed0902 100644 --- a/graph.py +++ b/graph.py @@ -97,7 +97,8 @@ class DotBackend: self.emit('%s [%s];' % (normalize_node_id(name), ", ".join(attrs))) def normalize_node_id(nid): - return nid.replace(' ', '_').replace('-', '_') + """returns a suitable DOT node id for `nid`""" + return '"%s"' % nid class GraphGenerator: def __init__(self, backend): -- cgit v1.2.1