24 Commits

Author SHA1 Message Date
Andrew Cassidy
37d2394466 Fix template search path
the source file path is now forwarded to the Harness object and on to the HTML generator code. Its the last argument to keep API compatibility. Ive also kept the output-relative search location to avoid anyone relying on that behavior
2025-07-11 15:51:43 -07:00
KV
73f56b2efc Apply black *.py ../../setup.py
black==23.3.0
2024-07-12 19:05:12 +02:00
KV
ae03bd60e5 Add TODOs about utf-8 encoding/charset (#395) 2024-07-07 16:16:56 +02:00
KV
19cdff1774 Avoid ResourceWarning: unclosed file (#395)
A number of such warnings showed up when running e.g.
PYTHONWARNINGS=always python build_examples.py
PYTHONWARNINGS=always wireviz ../../examples/demo0?.yml
See https://github.com/wireviz/WireViz/pull/309#issuecomment-2170988381

Fix: All open() calls should be in a "with open() as x" statement
to ensure closing the file when exiting the block in any way.
Otherwise, use the new file_read_text() or file_write_text() functions
to read or write the whole utf-8 text file and closing it.
2024-07-07 16:16:56 +02:00
KV
c997bfe19b Rename "sheetsize_default" to <!-- %template_sheetsize% --> (#380)
Fixes #377 (makes HTML output template placeholders more consistent)
2024-07-05 18:16:34 +02:00
KV
6ba33fb5dc Rename diagram_png_base64 to diagram_png_b64 (#371) 2024-07-05 18:22:24 +02:00
KV
70a33edca5 Avoid reading diagram file to embed unless used (#371)
Add local replacement_if_used() that call function to read the file
only when needed and append the return value as replacement.
2024-07-05 18:20:57 +02:00
KV
ea26116c81 Add HTML template placeholder for diagram_png_base64 (#371)
This will enable users to replace the SVG diagram with an embedded PNG,
that is an improved 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
2024-07-05 18:16:34 +02:00
KV
f474cddedb 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
2024-07-05 18:16:34 +02:00
Daniel Rojas
55c6ab51f1 Apply black 2024-05-05 15:50:59 +02:00
Daniel Rojas
6f9bb67d02 Embed images into SVG output 2021-10-16 22:39:41 +02:00
Daniel Rojas
d19c260940 Simplify file access operations 2021-10-16 22:27:00 +02:00
Daniel Rojas
c89cf735ae Apply some manual fixes, reapply black 2021-10-16 22:09:59 +02:00
Daniel Rojas
f92985a61c Apply black 2021-10-16 22:09:59 +02:00
Daniel Rojas
344615483a Apply isort 2021-10-16 22:09:59 +02:00
Daniel Rojas
a59f96aaa6 Apply suggestions from code review
Co-authored-by: kvid <kvid@users.noreply.github.com>
2021-10-16 21:52:05 +02:00
Daniel Rojas
aa9278da4b Apply suggestions from code review
Co-authored-by: kvid <kvid@users.noreply.github.com>
2021-10-16 21:52:05 +02:00
Daniel Rojas
406bdd36f2 Use regex-based replacement 2021-10-16 21:52:05 +02:00
Daniel Rojas
02963101d0 Implement fontname and bgcolor(WIP) replacement 2021-10-16 21:52:05 +02:00
Daniel Rojas
5bed6de7ab Consolidate code for replacing HTML placeholders 2021-10-16 21:52:05 +02:00
Daniel Rojas
eae2694b5d Implement template-based HTML output 2021-10-16 21:52:05 +02:00
Daniel Rojas
3cc36e1573 Harmonize shebangs and encoding info
- Use `#!/usr/bin/env python3` on executable modules
- Remove shebangs on all other `.py` files
- Add UTF-8 encoding info where mising
2021-10-11 20:05:52 +02:00
kvid
92354e6852
Add basic options and metadata (#214) 2021-08-25 19:46:37 +02:00
Daniel Rojas
96bd121403 Create separate modules for BOM and HTML functions 2020-11-15 08:42:57 +01:00