File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11ae 1 2
2- ae 1 3
3- ae 2 "a node"
2+ ae 1 "a \"node\""
3+ ae 2 "a \" node\" "
44ns
55hn 1
66ns
77hn 2
88ln 2 "foo bar"
99ns
10- hn "a node"
10+ hn "a \"node\""
11+ # this is a comment
1112ae 1 4
1213ns
1314un 2
Original file line number Diff line number Diff line change 1515# You should have received a copy of the GNU General Public License along with
1616# "GraphvizAnim". If not, see <http://www.gnu.org/licenses/>.
1717
18+ from email .utils import quote
1819import shlex
1920
2021import action
@@ -105,6 +106,7 @@ def parse( self, lines ):
105106 }
106107 for line in lines :
107108 parts = shlex .split ( line .strip (), True )
109+ if not parts : continue
108110 action , params = parts [ 0 ], parts [ 1 : ]
109111 try :
110112 action2method [ action ]( * params )
@@ -129,8 +131,8 @@ def graphs( self ):
129131 graphs = []
130132 for n , s in enumerate ( steps ):
131133 graph = [ 'digraph G {' ]
132- for v in V : graph .append ( '{} {};' .format ( v , s .node_format ( v ) ) )
133- for e in E : graph .append ( '{}->{} {};' .format ( e [ 0 ], e [ 1 ] , s .edge_format ( e ) ) )
134+ for v in V : graph .append ( '"{}" {};' .format ( quote ( v ) , s .node_format ( v ) ) )
135+ for e in E : graph .append ( '"{}" -> "{}" {};' .format ( quote ( e [ 0 ] ), quote ( e [ 1 ] ) , s .edge_format ( e ) ) )
134136 graph .append ( '}' )
135137 graphs .append ( '\n ' .join ( graph ) )
136138 return graphs
You can’t perform that action at this time.
0 commit comments