diff options
author | Adrien Di Mascio <Adrien.DiMascio@logilab.fr> | 2007-05-03 12:56:13 +0200 |
---|---|---|
committer | Adrien Di Mascio <Adrien.DiMascio@logilab.fr> | 2007-05-03 12:56:13 +0200 |
commit | 4d8ffbb3a788404b8ed15d0558a312e5b821b825 (patch) | |
tree | 4eeb73f4f6b5c8ba1713e82d5f202e615bbcd5cc /graph.py | |
parent | 6fd8e1c12a6ed0f64959698d5e820cbafa1efa76 (diff) | |
download | logilab-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.py | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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): |