src: wireviz: support extra metadata

This commit is contained in:
Laurier Loiselle 2023-01-20 17:25:29 -05:00
parent 85a141b4f1
commit 55da28d1a9
No known key found for this signature in database
GPG Key ID: 345920CC72089A3F

View File

@ -29,6 +29,7 @@ def parse(
output_dir: Union[str, Path] = None,
output_name: Union[None, str] = None,
image_paths: Union[Path, str, List] = [],
extra_metadata: Dict = {},
) -> Any:
"""
This function takes an input, parses it as a WireViz Harness file,
@ -73,6 +74,9 @@ def parse(
Paths to use when resolving any image paths included in the data.
Note: If inp is a path to a YAML file,
its parent directory will automatically be included in the list.
extra_metadata (Dict, optional):
Any metadata to add to the template.
Normally, this should contain programmatic metadata
Returns:
Depending on the return_types parameter, may return:
@ -107,7 +111,7 @@ def parse(
connection_sets = []
# actual harness
harness = Harness(
metadata=Metadata(**yaml_data.get("metadata", {})),
metadata=Metadata(**yaml_data.get("metadata", {}), **extra_metadata),
options=Options(**yaml_data.get("options", {})),
tweak=Tweak(**yaml_data.get("tweak", {})),
)