Fixes syntax error in older versions of graphviz.

Older versions of graphviz (tested on version 2.26.3 (20100126.1600))
complains when an attribute is empty without quotes. [label=] fails but
[label=""] works, so the quote_if_necessary function has been updated to
accommodate this.
This commit is contained in:
Gustav Larsson 2014-07-30 18:25:42 -05:00
parent 875bbfd89c
commit 13686776b9
1 changed files with 4 additions and 0 deletions

View File

@ -257,6 +257,10 @@ def needs_quotes(s):
def quote_if_necessary(s):
# Older versions of graphviz throws a syntax error for empty values without
# quotes, e.g. [label=]
if s == '':
return '""'
if isinstance(s, bool):
if s is True: