Add HTML template placeholders for filename (#371)
This will e.g. enable users to replace the SVG diagram with PNG, that is needed as a work-around when the SVG output from Graphviz is not looking good. Suggested as work-around for Graphviz bug in https://github.com/wireviz/WireViz/issues/175#issuecomment-2132206026 Co-authored-by: kvid <kvid@users.noreply.github.com>
This commit is contained in:
parent
ceaad3c39a
commit
287c47a65e
@ -126,6 +126,9 @@ def generate_html_output(
|
||||
"<!-- %fontname% -->": options.fontname,
|
||||
"<!-- %bgcolor% -->": options.bgcolor.html,
|
||||
"<!-- %diagram% -->": svgdata,
|
||||
# TODO: "<!-- %diagram_png_base64% -->": base64 of png file
|
||||
"<!-- %filename% -->": str(filename),
|
||||
"<!-- %filename_stem% -->": Path(filename).stem,
|
||||
"<!-- %bom% -->": bom_html,
|
||||
"<!-- %bom_reversed% -->": bom_html_reversed,
|
||||
"<!-- %sheet_current% -->": "1", # TODO: handle multi-page documents
|
||||
@ -142,9 +145,9 @@ def generate_html_output(
|
||||
if isinstance(entry, Dict):
|
||||
replacements[f"<!-- %{item}_{index+1}% -->"] = str(category)
|
||||
for entry_key, entry_value in entry.items():
|
||||
replacements[
|
||||
f"<!-- %{item}_{index+1}_{entry_key}% -->"
|
||||
] = html_line_breaks(str(entry_value))
|
||||
replacements[f"<!-- %{item}_{index+1}_{entry_key}% -->"] = (
|
||||
html_line_breaks(str(entry_value))
|
||||
)
|
||||
|
||||
replacements['"sheetsize_default"'] = '"{}"'.format(
|
||||
metadata.get("template", {}).get("sheetsize", "")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user