Skip to content

Commit

Permalink
Update syntax description
Browse files Browse the repository at this point in the history
  • Loading branch information
17o2 committed Apr 16, 2024
1 parent 8ba9131 commit 2ad2222
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions docs/syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ connections:
```

- Each connection set is a list of components.
- The minimum number of items is two.
- 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 `<pin>`s and `<wire>`s for each component in the set must match. When specifying only one designator, one is auto-generated for each connection of the set.
Expand All @@ -207,7 +207,6 @@ connections:
- `- <designator>: <int/str>` attaches a pin of the connector, referring to a pin number (from the connector's `pins` attribute) or a pin label (from its `pinlabels` attribute), provided the label is unique.

- `- <designator>` is allowed for simple connectors, since they have only one pin to connect.
For connectors with `autogenerate: true`, a new instance, with auto-generated designator, is created.

#### Cables

Expand All @@ -230,14 +229,10 @@ For connectors with `autogenerate: true`, a new instance, with auto-generated de
- `- [<designator>, ..., <designator>]`

Attaches multiple different single pin connectors, one per connection in the set.
For connectors with `autogenerate: true`, a new instance, with auto-generated designator, is created with every mention.
Auto-generated and non-autogenerated connectors may be mixed.

- `- <designator>`

Attaches multiple instances of the same single pin connector, one per connectioin in the set.
For connectors with `autogenerate: true`, a new instance, with auto-generated designator, is created for every connection in the set.
Since only connectors with `pincount: 1` can be auto-generated, pin number 1 is implicit.

#### Cables

Expand Down Expand Up @@ -280,7 +275,9 @@ connections:
### Autogeneration of items
For very simple, recurring connectors such as crimp ferrules, splices and others, where it would be a hassle to individually assign unique designators for every instance, autogeneration may be used. Both connectors and cables can be autogenerated.
If multiple identical copies of a connector or cable are needed, it is possible to define them once as a template, and then generate multiple instances as needed. This is called autogeneration. Both connectors and cables can be autogenerated.
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):

Expand Down Expand Up @@ -325,6 +322,24 @@ If a component is to be used in other connection sets (e.g. for a three-way spli
Names of autogenerated components are hidden by default. While they can be shown in the graphical output using the `show_name: true` option, it is not recommended to manually use the internally assigned designator (starting with a double underscore `__`), since it might change in future WireViz versions, or when the order of items in connection sets changes.


### Unconnected components

Even if a component is not connected to any other components, it must be mentioned in a connection set for it to be displayed.

```yaml
connectors:
X1: # this connector will not be connected to any other components
...
connections:
-
- X1 # minimal connection set to include connector in the diagram
```

If any component is defined in the `connectors` or `cables` sections but not referenced in `connections`, a warning is printed in the console.


## Metadata entries

```yaml
Expand Down

0 comments on commit 2ad2222

Please sign in to comment.