Fix bug in refactoring of #55, add SVG output option
This commit is contained in:
parent
144c99e021
commit
de1e45f72b
@ -264,6 +264,15 @@ class Harness:
|
||||
data.seek(0)
|
||||
return data.read()
|
||||
|
||||
@property
|
||||
def svg(self):
|
||||
from io import BytesIO
|
||||
graph = self.create_graph()
|
||||
data = BytesIO()
|
||||
data.write(graph.pipe(format='svg'))
|
||||
data.seek(0)
|
||||
return data.read()
|
||||
|
||||
def output(self, filename, directory='_output', view=False, cleanup=True, fmt='pdf', gen_bom=False):
|
||||
# graphical output
|
||||
graph = self.create_graph()
|
||||
|
||||
@ -205,8 +205,10 @@ def parse(yaml_input, file_out=None, generate_bom=False, return_types: (None, st
|
||||
|
||||
if 'png' in return_types:
|
||||
returns.append(harness.png)
|
||||
if 'svg' in return_types:
|
||||
returns.append(harness.svg)
|
||||
|
||||
return tuple(returns) if len(returns) != 1 else returns
|
||||
return tuple(returns) if len(returns) != 1 else returns[0]
|
||||
|
||||
|
||||
def parse_file(yaml_file, file_out=None, generate_bom=False):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user