summaryrefslogtreecommitdiff
path: root/graph.py
diff options
context:
space:
mode:
authorAdrien Di Mascio <Adrien.DiMascio@logilab.fr>2007-05-03 12:56:13 +0200
committerAdrien Di Mascio <Adrien.DiMascio@logilab.fr>2007-05-03 12:56:13 +0200
commit4d8ffbb3a788404b8ed15d0558a312e5b821b825 (patch)
tree4eeb73f4f6b5c8ba1713e82d5f202e615bbcd5cc /graph.py
parent6fd8e1c12a6ed0f64959698d5e820cbafa1efa76 (diff)
downloadlogilab-common-4d8ffbb3a788404b8ed15d0558a312e5b821b825.tar.gz
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
Diffstat (limited to 'graph.py')
-rw-r--r--graph.py3
1 files changed, 2 insertions, 1 deletions
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):