Use output_name as default title (#361)
The CLI handling code was redesigned for v0.4 and it seems the code to assign a default title from v0.3.1 has been messed up. This bug has not been triggered by build_examples.py due to it seems to call the parse() function differently. The output_name should be used as default title when present. This will fix the #360 bug report. Co-authored-by: kvid <kvid@users.noreply.github.com>
This commit is contained in:
parent
50b190113b
commit
32a62a6dd7
@ -21,6 +21,8 @@ from wireviz.wv_utils import (
|
|||||||
smart_file_resolve,
|
smart_file_resolve,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from . import APP_NAME
|
||||||
|
|
||||||
|
|
||||||
def parse(
|
def parse(
|
||||||
inp: Union[Path, str, Dict],
|
inp: Union[Path, str, Dict],
|
||||||
@ -118,9 +120,7 @@ def parse(
|
|||||||
|
|
||||||
# When title is not given, either deduce it from filename, or use default text.
|
# When title is not given, either deduce it from filename, or use default text.
|
||||||
if "title" not in harness.metadata:
|
if "title" not in harness.metadata:
|
||||||
harness.metadata["title"] = (
|
harness.metadata["title"] = output_name or f"{APP_NAME} diagram and BOM"
|
||||||
Path(yaml_file).stem if yaml_file else "WireViz diagram and BOM"
|
|
||||||
)
|
|
||||||
|
|
||||||
# add items
|
# add items
|
||||||
# parse YAML input file ====================================================
|
# parse YAML input file ====================================================
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user