From c7d643bf293ce1c5984641b29c7ae8dbd74f27f5 Mon Sep 17 00:00:00 2001 From: Martin Rieder <74277074+martinrieder@users.noreply.github.com> Date: Fri, 14 Jun 2024 15:13:19 +0200 Subject: [PATCH 1/6] Image syntax description missing `scale` and `fixedsize` --- docs/syntax.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/syntax.md b/docs/syntax.md index 2c92fd34..53234bb5 100644 --- a/docs/syntax.md +++ b/docs/syntax.md @@ -536,6 +536,8 @@ image: height: # range: 1~65535; unit: points # if only one dimension (width/height) is specified, the image is scaled proportionally. # if both width and height are specified, the image is stretched to fit. + scale: # Which dimension to scale ['false', 'true', 'width', 'height', 'both'] + fixedsize: # If only one dimension is specified, compute the other ``` For more fine grained control over the image parameters, please see [`advanced_image_usage.md`](advanced_image_usage.md). From 7da3554b76a88125506647e797d02a4b300a3f5c Mon Sep 17 00:00:00 2001 From: Martin Rieder <74277074+martinrieder@users.noreply.github.com> Date: Tue, 2 Jul 2024 01:40:21 +0200 Subject: [PATCH 2/6] Write some clarification for syntax.md --- docs/syntax.md | 61 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 46 insertions(+), 15 deletions(-) diff --git a/docs/syntax.md b/docs/syntax.md index 53234bb5..93325a46 100644 --- a/docs/syntax.md +++ b/docs/syntax.md @@ -1,7 +1,35 @@ # WireViz Syntax +WireViz input files are created as plain text based on YAML, which does not require any special editor. International character sets and technical symbols are also supported through UTF-8. +See the following sections of this document about further details: + + - **[Main sections](#main-sections)** + - [Colors](#colors) + - [Cable color codes](#cable-color-codes) + - [Images](#images) + - [Multiline Strings](#multiline-strings) + - [Inheritance](#inheritance) + +The YAML syntax is human readable and supports version control because of its hierarchical structure. +The input files would normally be saved using a text editor to the file extension `.yml` or `.yaml`. + +See the [tutorial page](../tutorial/readme.md) for sample code, as well as the [example gallery](../examples/readme.md) to see more of what WireViz can do. + ## Main sections +The main sections at the highest hierarchical level of the document may contain any of the following: + + - [Connectors](#connector-attributes) + - [Cables](#cable-attributes) + - [Connections](#connection-sets) + - [Metadata](#metadata-entries) + - [Options](#options) + - [BOM items and additional components](#bom-items-and-additional-components) + - [GraphViz tweaking](#graphviz-tweaking-experimental) + +Their respective attribute assignments need to be indented using space characters on every line. +Make sure they are aligned correctly in the document hierarchy, i.e. by two spaces for each level! + ```yaml connectors: # dictionary of all used connectors : # unique connector designator/name @@ -154,6 +182,15 @@ tweak: # optional tweaking of .gv output A connection set is used to connect multiple components together. Multiple connections can be easily created in parallel within one connection set, by specifying a list of individual pins (for `connectors`) or wires (for `cables`) for every component along the way. +- Each connection set is a list of components. +- The minimum number of items is one. +- The maximum number of items is unlimited. +- Items must alternatingly belong to the `connectors` and the `cables` sections. +- When a connection set defines multiple parallel connections, the number of specified ``s and ``s for each component in the set must match. When specifying only one designator, one is auto-generated for each connection of the set. +- `` may reference a pin's unique ID (as per the connector's `pins` attribute, auto-numbered from 1 by default) or its label (as per `pinlabels`). +- `` may reference a wire's number within a cable/bundle, its label (as per `wirelabels`) or, if unambiguous, its color. +- For ``, see below. + ```yaml connections: - # Each list entry is a connection set @@ -191,15 +228,6 @@ connections: ... ``` -- Each connection set is a list of components. -- The minimum number of items is one. -- The maximum number of items is unlimited. -- Items must alternatingly belong to the `connectors` and the `cables` sections. -- When a connection set defines multiple parallel connections, the number of specified ``s and ``s for each component in the set must match. When specifying only one designator, one is auto-generated for each connection of the set. -- `` may reference a pin's unique ID (as per the connector's `pins` attribute, auto-numbered from 1 by default) or its label (as per `pinlabels`). -- `` may reference a wire's number within a cable/bundle, its label (as per `wirelabels`) or, if unambiguous, its color. -- For ``, see below. - ### Single connections #### Connectors @@ -279,7 +307,7 @@ If multiple identical copies of a connector or cable are needed, it is possible Autogenerated instances of components can be explicitly assigned a designator; this way, they can be referenced in multiple connection sets. However, it is also possible to generate unnamed instances of components. This is especially useful for components that do not need to be referenced in more than one connection set, and where naming each individual instance is an unnecessary complication. -Example (see `connections` section): +Example (see [`connections`](#connection-sets) section): ```yaml connectors: @@ -447,6 +475,9 @@ Alternatively items can be added to just the BOM by putting them in the section ## GraphViz tweaking (experimental) +This feature is experimental and might change or be removed in future versions. + + ```yaml # Optional tweaking of the .gv output. # This feature is experimental and might change @@ -472,10 +503,7 @@ Alternatively items can be added to just the BOM by putting them in the section ## Colors -Colors are defined via uppercase, two character strings. -Striped/banded wires can be specified by simply concatenating multiple colors, with no space inbetween, eg. `GNYE` for green-yellow. - -The following colors are understood: +Colors are defined via uppercase, two character strings. The following colors are understood: - `BK` ![##000000](https://via.placeholder.com/15/000000/000000?text=+) (black) - `WH` ![##ffffff](https://via.placeholder.com/15/ffffff/000000?text=+) (white) @@ -502,12 +530,15 @@ The following colors are understood: +Striped/banded wires can be specified by simply concatenating multiple colors, +with no space inbetween, eg. `GNYE` for green-yellow. + It is also possible to specify colors as hexadecimal RGB values, e.g. `#112233` or `#FFFF00:#009900`. Remember quoting strings containing a `#` in the YAML file. ## Cable color codes -Supported color codes: +Supported values for different international color coding standards are: - `DIN` for [DIN 47100](https://en.wikipedia.org/wiki/DIN_47100) From f5e4c061c1def874817d9fce764c192727fe527b Mon Sep 17 00:00:00 2001 From: Martin Rieder <74277074+martinrieder@users.noreply.github.com> Date: Tue, 2 Jul 2024 01:48:14 +0200 Subject: [PATCH 3/6] Add color coding letters to syntax.md --- docs/syntax.md | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/docs/syntax.md b/docs/syntax.md index 93325a46..d34813ac 100644 --- a/docs/syntax.md +++ b/docs/syntax.md @@ -540,13 +540,32 @@ Remember quoting strings containing a `#` in the YAML file. Supported values for different international color coding standards are: -- `DIN` for [DIN 47100](https://en.wikipedia.org/wiki/DIN_47100) - - ![##ffffff](https://via.placeholder.com/15/ffffff/000000?text=+) ![##895956](https://via.placeholder.com/15/895956/000000?text=+) ![##00ff00](https://via.placeholder.com/15/00ff00/000000?text=+) ![##ffff00](https://via.placeholder.com/15/ffff00/000000?text=+) ![##999999](https://via.placeholder.com/15/999999/000000?text=+) ![##ff66cc](https://via.placeholder.com/15/ff66cc/000000?text=+) ![##0066ff](https://via.placeholder.com/15/0066ff/000000?text=+) ![##ff0000](https://via.placeholder.com/15/ff0000/000000?text=+) ![##000000](https://via.placeholder.com/15/000000/000000?text=+) ![##8000ff](https://via.placeholder.com/15/8000ff/000000?text=+) ... - -- `IEC` for [IEC 60757](https://en.wikipedia.org/wiki/Electronic_color_code#Color_band_system) ("ROY G BIV") - - ![##895956](https://via.placeholder.com/15/895956/000000?text=+) ![##ff0000](https://via.placeholder.com/15/ff0000/000000?text=+) ![##ff8000](https://via.placeholder.com/15/ff8000/000000?text=+) ![##ffff00](https://via.placeholder.com/15/ffff00/000000?text=+) ![##00ff00](https://via.placeholder.com/15/00ff00/000000?text=+) ![##0066ff](https://via.placeholder.com/15/0066ff/000000?text=+) ![##8000ff](https://via.placeholder.com/15/8000ff/000000?text=+) ![##999999](https://via.placeholder.com/15/999999/000000?text=+) ![##ffffff](https://via.placeholder.com/15/ffffff/000000?text=+) ![##000000](https://via.placeholder.com/15/000000/000000?text=+) ... +- `DIN` for [DIN 47100](https://en.wikipedia.org/wiki/DIN_47100) (WT/BN/GN/YE/GY/PK/BU/RD/BK/VT/...) + + ![##ffffff](https://via.placeholder.com/15/ffffff/000000?text=WT) + ![##895956](https://via.placeholder.com/15/895956/000000?text=BN) + ![##00ff00](https://via.placeholder.com/15/00ff00/000000?text=GN) + ![##ffff00](https://via.placeholder.com/15/ffff00/000000?text=YE) + ![##999999](https://via.placeholder.com/15/999999/000000?text=GY) + ![##ff66cc](https://via.placeholder.com/15/ff66cc/000000?text=PK) + ![##0066ff](https://via.placeholder.com/15/0066ff/000000?text=BU) + ![##ff0000](https://via.placeholder.com/15/ff0000/000000?text=RD) + ![##000000](https://via.placeholder.com/15/000000/ffffff?text=BK) + ![##8000ff](https://via.placeholder.com/15/8000ff/000000?text=VT) + +- `IEC` for [IEC 60757](https://en.wikipedia.org/wiki/Electronic_color_code#Color_band_system) + (BN/RD/OR/YE/GN/BU/VT/GY/WT/BK/...) + + ![##895956](https://via.placeholder.com/15/895956/000000?text=BN) + ![##ff0000](https://via.placeholder.com/15/ff0000/000000?text=RD) + ![##ff8000](https://via.placeholder.com/15/ff8000/000000?text=OR) + ![##ffff00](https://via.placeholder.com/15/ffff00/000000?text=YE) + ![##00ff00](https://via.placeholder.com/15/00ff00/000000?text=GN) + ![##0066ff](https://via.placeholder.com/15/0066ff/000000?text=BU) + ![##8000ff](https://via.placeholder.com/15/8000ff/000000?text=VT) + ![##999999](https://via.placeholder.com/15/999999/000000?text=GY) + ![##ffffff](https://via.placeholder.com/15/ffffff/000000?text=WT) + ![##000000](https://via.placeholder.com/15/000000/ffffff?text=BK) - `TEL` and `TELALT` for [25-pair color code](https://en.wikipedia.org/wiki/25-pair_color_code) - `T568A` and `T568B` for [TIA/EIA-568](https://en.wikipedia.org/wiki/TIA/EIA-568#Wiring) (e.g. Ethernet) From a6504fd6c9c7b2ea2bb69a40038009ce3d4135dd Mon Sep 17 00:00:00 2001 From: Martin Rieder <74277074+martinrieder@users.noreply.github.com> Date: Tue, 2 Jul 2024 01:56:12 +0200 Subject: [PATCH 4/6] Correct indentation and <...> brackets --- docs/syntax.md | 366 ++++++++++++++++++++++++------------------------- 1 file changed, 182 insertions(+), 184 deletions(-) diff --git a/docs/syntax.md b/docs/syntax.md index d34813ac..25e1fc85 100644 --- a/docs/syntax.md +++ b/docs/syntax.md @@ -31,150 +31,153 @@ Their respective attribute assignments need to be indented using space character Make sure they are aligned correctly in the document hierarchy, i.e. by two spaces for each level! ```yaml -connectors: # dictionary of all used connectors - : # unique connector designator/name - ... # connector attributes (see below) - : - ... - ... - -cables: # dictionary of all used cables and wires - : # unique cable designator/name - ... # cable attributes (see below) - : - ... - ... - -connections: # list of all connections to be made - # between cables and connectors +connectors: # dictionary of all used connectors + : # unique connector designator/name + : <...> # connector attributes (see below) + : + : <...> + <...> + +cables: # dictionary of all used cables and wires + : # unique cable designator/name + : <...> # cable attributes (see below) + : + : <...> + <...> + +connections: # list of all connection sets (see below) - - ... # connection set (see below) + - <...> # or + - <...> # or - - ... - ... + - <...> + <...> additional_bom_items: # custom items to add to BOM - - # BOM item (see below) - ... + - # BOM item (see below) + : <...> -metadata: # dictionary of meta-information describing the harness - : # any number of key value pairs (see below) - ... +metadata: # dictionary of meta-information describing the harness + : # any number of key value pairs (see below) + <...> -options: # dictionary of common attributes for the whole harness - : # optional harness attributes (see below) - ... +options: # dictionary of common attributes for the whole harness + : # optional harness attributes (see below) + <...> -tweak: # optional tweaking of .gv output - ... +tweak: # optional tweaking of .gv output + <...> ``` + ## Connector attributes ```yaml - : # unique connector designator/name - # general information about a connector (all optional) - type: - subtype: - color: # see below - image: # see below - notes: - - # product information (all optional) - ignore_in_bom: # if set to true the connector is not added to the BOM - pn: # [internal] part number - manufacturer: # manufacturer name - mpn: # manufacturer part number - supplier: # supplier name - spn: # supplier part number - additional_components: # additional components - - # additional component (see below) - - # pinout information - # at least one of the following must be specified - pincount: # if omitted, is set to length of specified list(s) - pins: # if omitted, is autofilled with [1, 2, ..., pincount] - pinlabels: # if omitted, is autofilled with blanks - - # pin color marks (optional) - pincolors: # list of colors to be assigned to the respective pins; - # if list length is lower than connector pinout, - # no color marks will be added to remaining pins - - # rendering information (all optional) - bgcolor: # Background color of diagram connector box - bgcolor_title: # Background color of title in diagram connector box - style: