Commit e4f485e
Address PR #10 review feedback: data URIs, errors, source_path auto-fill
Five gemini-code-assist comments on
#10:
* Data URI leading-space stripped in three places (svgembed.py
data_URI_base64 and embed_svg_images, plus Harness._render's PNG
b64 inline). The prior ``data:image/png;base64, <b64>`` form had a
stray space after the comma which violates RFC 2397; most browsers
tolerate it but stricter parsers (some PDF/EPUB tooling, lint tools)
reject it. All three call sites now emit the canonical
``data:image/png;base64,<b64>``.
* wv_cli.py: ``raise Exception("Unknown output format: ...")`` →
``raise click.UsageError(...)``. Matches the multi-format-stdout
check elsewhere in the file and gives users the clean
``Try 'wireviz -h' for help.\nError: ...`` UX instead of a Python
traceback.
* wv_cli.py: stdin mode now defaults ``image_paths`` to
``{Path.cwd()}`` instead of an empty set, so relative
``image: src:`` references in piped YAML resolve against the
invocation directory the same way file-based input resolves
against the YAML's parent.
* Harness._extend_tweak: tweak override conflict error now reports
both the existing and new values
(``"X1.tweak.override.X1.color: new value 'blue' conflicts with
existing 'red'"``) instead of the prior vague ``"conflicts with
another"``.
* wireviz.parse(): ``source_path`` now auto-fills from ``yaml_file``
when the input was a Path. The docstring already promised this
behavior; the code didn't actually do it. Confirmed via
``parse(Path('examples/demo01.yml'), output_formats=('svg',), ...)``
succeeding without explicit source_path.
Verified against build_examples.py: deterministic outputs (.gv,
.bom.tsv) byte-identical to baseline. Tweak conflict YAML correctly
raises the new error. Bad CLI format flag now renders Click's
UsageError formatting. Data URIs in re-rendered ex08.svg / .html now
emit ``data:image/png;base64,iVB...`` (no space).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent c66441e commit e4f485e
4 files changed
Lines changed: 15 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
175 | | - | |
| 175 | + | |
| 176 | + | |
176 | 177 | | |
177 | 178 | | |
178 | 179 | | |
| |||
935 | 936 | | |
936 | 937 | | |
937 | 938 | | |
938 | | - | |
| 939 | + | |
939 | 940 | | |
940 | 941 | | |
941 | 942 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
115 | 119 | | |
116 | 120 | | |
117 | 121 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
| 119 | + | |
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
153 | | - | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
154 | 158 | | |
155 | 159 | | |
156 | 160 | | |
| |||
0 commit comments