Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
a8abc2b
Add --template-dir CLI option (port of upstream PR #444)
SomethingNew71 May 4, 2026
c3b2576
Add output_dpi option (port of upstream PR #379)
SomethingNew71 May 5, 2026
c0f8eee
Document new parameters in Harness.output(), _render(), and parse()
SomethingNew71 May 5, 2026
0d87b44
Skip dpi graph attr when output_dpi is None (PR #4 review feedback)
SomethingNew71 May 5, 2026
a658cc7
Merge pull request #3 from ClassicMiniDIY/port-444-template-dir
SomethingNew71 May 5, 2026
3d925b2
Merge pull request #4 from ClassicMiniDIY/port-379-output-dpi
SomethingNew71 May 5, 2026
dee9e67
Embed YAML source in PNG output for round-trip editing (port of upstr…
SomethingNew71 May 5, 2026
33f63b5
Add <!-- %revision% --> HTML template placeholder (port of upstream P…
SomethingNew71 May 5, 2026
9b055ab
Handle scalar/None ``revisions`` value in _latest_revision (PR #6 rev…
SomethingNew71 May 5, 2026
e75ff5c
Add per-connector / per-cable tweak with name placeholder (port of up…
SomethingNew71 May 5, 2026
39129a4
Harden _extend_tweak against None override values (PR #7 review feedb…
SomethingNew71 May 5, 2026
44e1951
Wire up PDF output (port of upstream PR #367)
SomethingNew71 May 5, 2026
10baef3
Align parse() PDF docstring with diagram-only reality (PR #8 review f…
SomethingNew71 May 5, 2026
885ae5e
Merge pull request #5 from ClassicMiniDIY/port-234-yaml-in-png
SomethingNew71 May 5, 2026
e789a70
Merge pull request #6 from ClassicMiniDIY/port-492-revision-placeholder
SomethingNew71 May 5, 2026
8a105e7
Merge pull request #7 from ClassicMiniDIY/port-357-per-node-tweak
SomethingNew71 May 5, 2026
c66441e
Merge pull request #8 from ClassicMiniDIY/port-367-pdf-output
SomethingNew71 May 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions docs/syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ tweak: # optional tweaking of .gv output
# loops
loops: <List> # every list item is itself a list of exactly two pins
# on the connector that are to be shorted

# optional tweaking of .gv output executed for each instance of this connector
tweak: # see tweak section below
```

## Cable attributes
Expand Down Expand Up @@ -148,6 +151,8 @@ tweak: # optional tweaking of .gv output
show_wirecount: <bool> # defaults to true
show_wirenumbers: <bool> # defaults to true for cables; false for bundles

# optional tweaking of .gv output executed for each instance of this cable
tweak: # see tweak section below
```

## Connection sets
Expand Down Expand Up @@ -393,6 +398,11 @@ See [HTML Output Templates](../src/wireviz/templates/) for how metadata entries

# Character to split template and designator for autogenerated components
template_separator: <str> # Default = '.'

# Graphviz dpi attribute (https://graphviz.org/docs/attrs/dpi/).
# Controls the resolution of raster (PNG) output and the size unit of
# vector (SVG) output.
output_dpi: <float> # Default = 96.0
```


Expand Down Expand Up @@ -452,6 +462,12 @@ Alternatively items can be added to just the BOM by putting them in the section
# This feature is experimental and might change
# or be removed in future versions.

placeholder: <str> # Substring to be replaced with the node name in
# any per-connector / per-cable tweak overrides and append entries.
# An empty string disables placeholder substitution for that node.
# When omitted at the per-node level, the global placeholder
# (in the top-level tweak: section) is used as the fallback.

override: # dict of .gv entries to override
# Each entry is identified by its leading string
# in lines beginning with a TAB character.
Expand Down
2 changes: 1 addition & 1 deletion examples/demo01.gv

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/demo02.gv

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/ex01.gv

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/ex02.gv

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/ex03.gv

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/ex04.gv

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/ex05.gv

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/ex06.gv

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/ex07.gv

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/ex09.gv

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/ex10.gv

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/ex11.gv

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/ex12.gv

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/ex13.gv

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/ex14.gv

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions src/wireviz/DataClasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ class Options:
color_mode: ColorMode = "SHORT"
mini_bom_mode: bool = True
template_separator: str = "."
# Graphviz dpi attribute (https://graphviz.org/docs/attrs/dpi/) — controls
# the resolution of raster (PNG) output and the size unit of vector (SVG)
# output. Default 96.0 matches Graphviz's default for non-PostScript
# output. Set to ``null`` in YAML (``None`` in Python) to omit the dpi
# attribute entirely and let Graphviz pick its renderer-specific default.
output_dpi: Optional[float] = 96.0

def __post_init__(self):
if not self.bgcolor_node:
Expand All @@ -73,6 +79,7 @@ def __post_init__(self):

@dataclass
class Tweak:
placeholder: Optional[PlainText] = None
override: Optional[Dict[Designator, Dict[str, Optional[str]]]] = None
append: Union[str, List[str], None] = None

Expand Down Expand Up @@ -164,10 +171,13 @@ class Connector:
loops: List[List[Pin]] = field(default_factory=list)
ignore_in_bom: bool = False
additional_components: List[AdditionalComponent] = field(default_factory=list)
tweak: Optional[Tweak] = None

def __post_init__(self) -> None:
if isinstance(self.image, dict):
self.image = Image(**self.image)
if isinstance(self.tweak, dict):
self.tweak = Tweak(**self.tweak)

self.ports_left = False
self.ports_right = False
Expand Down Expand Up @@ -329,10 +339,13 @@ class Cable:
show_wirenumbers: Optional[bool] = None
ignore_in_bom: bool = False
additional_components: List[AdditionalComponent] = field(default_factory=list)
tweak: Optional[Tweak] = None

def __post_init__(self) -> None:
if isinstance(self.image, dict):
self.image = Image(**self.image)
if isinstance(self.tweak, dict):
self.tweak = Tweak(**self.tweak)

if isinstance(self.gauge, str): # gauge and unit specified
try:
Expand Down
Loading