Compare commits
3 Commits
4da9fe4886
...
3d639f6ec2
| Author | SHA1 | Date | |
|---|---|---|---|
| 3d639f6ec2 | |||
| 79be720eab | |||
| 254be36948 |
@ -40,6 +40,7 @@ Note that there must be one single space between `--` and `%` at both ends.
|
||||
| `<!-- %sheet_total% -->` | `1` (multi-page documents not yet supported) |
|
||||
| `<!-- %diagram% -->` | Embedded SVG diagram as valid HTML |
|
||||
| `<!-- %diagram_png_b64% -->` | Embedded base64 encoded PNG diagram as URI |
|
||||
| `<!-- %revision% -->` | The name of the last revision |
|
||||
| `<!-- %{item}% -->` | String or numeric value of `metadata.{item}` |
|
||||
| `<!-- %{item}_{i}% -->` | Category number `{i}` within dict value of `metadata.{item}` |
|
||||
| `<!-- %{item}_{i}_{key}% -->` | Value of `metadata.{item}.{category}.{key}` |
|
||||
|
||||
@ -87,6 +87,7 @@ class Options:
|
||||
color_output_mode: ColorOutputMode = ColorOutputMode.EN_UPPER
|
||||
mini_bom_mode: bool = True
|
||||
template_separator: str = "."
|
||||
output_dpi: Optional[float] = 96.0
|
||||
_pad: int = 0
|
||||
# TODO: resolve template and image paths during rendering, not during YAML parsing
|
||||
_template_paths: List = field(default_factory=list)
|
||||
|
||||
@ -632,6 +632,7 @@ def set_dot_basics(dot, options):
|
||||
bgcolor=options.bgcolor.html,
|
||||
nodesep="0.33",
|
||||
fontname=options.fontname,
|
||||
dpi=f"{options.output_dpi}",
|
||||
) # TODO: Add graph attribute: charset="utf-8",
|
||||
dot.attr(
|
||||
"node",
|
||||
|
||||
@ -15,7 +15,7 @@ from wireviz.wv_utils import (
|
||||
smart_file_resolve,
|
||||
)
|
||||
|
||||
mime_subtype_replacements = {"jpg": "jpeg", "tif": "tiff"}
|
||||
mime_subtype_replacements = {"jpg": "jpeg", "svg": "svg+xml", "tif": "tiff"}
|
||||
|
||||
|
||||
# TODO: Share cache and code between data_URI_base64() and embed_svg_images()
|
||||
@ -64,6 +64,12 @@ def get_mime_subtype(filename: Union[str, Path]) -> str:
|
||||
return mime_subtype
|
||||
|
||||
|
||||
def _get_latest_revision(metadata: Dict) -> str:
|
||||
if "revisions" not in metadata:
|
||||
return ""
|
||||
return list(metadata.get("revisions"))[-1]
|
||||
|
||||
|
||||
def embed_svg_images_file(
|
||||
filename_in: Union[str, Path], overwrite: bool = True
|
||||
) -> None:
|
||||
@ -152,6 +158,7 @@ def generate_html_output(
|
||||
"<!-- %template_sheetsize% -->": metadata.get("template", {}).get(
|
||||
"sheetsize", ""
|
||||
),
|
||||
"<!-- %revision% -->": _get_latest_revision(metadata),
|
||||
}
|
||||
|
||||
def replacement_if_used(key: str, func: Callable[[], str]) -> None:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user