From 287c47a65ea99104e24db75b157e70f734bc6c27 Mon Sep 17 00:00:00 2001 From: Daniel Rojas Date: Sat, 1 Mar 2025 18:27:54 +0100 Subject: [PATCH] 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 --- src/wireviz/wv_output.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/wireviz/wv_output.py b/src/wireviz/wv_output.py index d5f686b..c9eb00a 100644 --- a/src/wireviz/wv_output.py +++ b/src/wireviz/wv_output.py @@ -126,6 +126,9 @@ def generate_html_output( "": options.fontname, "": options.bgcolor.html, "": svgdata, + # TODO: "": base64 of png file + "": str(filename), + "": Path(filename).stem, "": bom_html, "": bom_html_reversed, "": "1", # TODO: handle multi-page documents @@ -142,9 +145,9 @@ def generate_html_output( if isinstance(entry, Dict): replacements[f""] = str(category) for entry_key, entry_value in entry.items(): - replacements[ - f"" - ] = html_line_breaks(str(entry_value)) + replacements[f""] = ( + html_line_breaks(str(entry_value)) + ) replacements['"sheetsize_default"'] = '"{}"'.format( metadata.get("template", {}).get("sheetsize", "")