Add syntax highlighting to readme's

This commit is contained in:
Daniel Rojas 2020-06-15 17:58:29 +02:00
parent 07fa0e2ee2
commit 37f0f8b408
3 changed files with 262 additions and 244 deletions

View File

@ -30,7 +30,8 @@ _Note_: WireViz is not designed to represent the complete wiring of a system. It
[WireViz input file](examples/demo01.yml):
connectors:
```yaml
connectors:
X1:
type: D-Sub
subtype: female
@ -40,7 +41,7 @@ _Note_: WireViz is not designed to represent the complete wiring of a system. It
subtype: female
pinout: [GND, RX, TX]
cables:
cables:
W1:
gauge: 0.25 mm2
length: 0.2
@ -48,7 +49,7 @@ _Note_: WireViz is not designed to represent the complete wiring of a system. It
wirecount: 3
shield: true
connections:
connections:
-
- X1: [5,2,1]
- W1: [1,2,3]
@ -56,6 +57,7 @@ _Note_: WireViz is not designed to represent the complete wiring of a system. It
-
- X1: 5
- W1: s
```
Output file:

View File

@ -33,12 +33,14 @@ if tutorials:
with open(os.path.abspath('../tutorial/tutorial{:02d}.md'.format(i)), 'r') as info:
for line in info:
file.write('{}'.format(line))
file.write(line)
file.write('\n[Source](tutorial{:02d}.yml):\n\n'.format(i))
with open(os.path.abspath('../tutorial/tutorial{:02d}.yml'.format(i)), 'r') as src:
file.write('```yaml\n')
for line in src:
file.write(' {}'.format(line))
file.write(line)
file.write('```\n')
file.write('\n')
file.write('\nOutput:\n\n'.format(i))

View File

@ -6,22 +6,24 @@
[Source](tutorial01.yml):
connectors:
```yaml
connectors:
X1:
pincount: 4
X2:
pincount: 4
cables:
cables:
W1:
wirecount: 4
length: 1
connections:
connections:
-
- X1: [1-4]
- W1: [1-4]
- X2: [1-4]
```
Output:
@ -36,7 +38,8 @@ Output:
[Source](tutorial02.yml):
connectors:
```yaml
connectors:
X1:
pincount: 4
# More connector parameters:
@ -47,7 +50,7 @@ Output:
type: Molex KK 254
subtype: female
cables:
cables:
W1:
wirecount: 4
# more cable parameters:
@ -56,12 +59,13 @@ Output:
show_equiv: true
colors: [WH, BN, GN, YE]
connections:
connections:
-
- X1: [1-4]
- W1: [1-4]
# non-sequential wiring:
- X2: [1,2,4,3]
```
Output:
@ -78,7 +82,8 @@ Output:
[Source](tutorial03.yml):
connectors:
```yaml
connectors:
X1: &template1 # define a template for later use
pinout: [GND, VCC, RX, TX] # pincount implicit in pinout
type: Molex KK 254
@ -86,7 +91,7 @@ Output:
X2:
<<: *template1 # reuse template
cables:
cables:
W1:
wirecount: 4
length: 1
@ -95,7 +100,7 @@ Output:
color_code: DIN # auto-assign colors based on DIN 47100
shield: true # add cable shielding
connections:
connections:
-
- X1: [1-4]
- W1: [1-4]
@ -103,6 +108,7 @@ Output:
- # connect the shielding to a pin
- X1: 1
- W1: s
```
Output:
@ -117,7 +123,8 @@ Output:
[Source](tutorial04.yml):
connectors:
```yaml
connectors:
X1: &template_con
pinout: [GND, VCC, SCL, SDA]
type: Molex KK 254
@ -132,7 +139,7 @@ Output:
subtype: female
notes: to temperature sensor
cables:
cables:
W1: &template_cbl
wirecount: 4
length: 0.3
@ -142,7 +149,7 @@ Output:
<<: *template_cbl
length: 0.1
connections:
connections:
-
- X1: [1-4]
- W1: [1-4]
@ -151,6 +158,7 @@ Output:
- X2: [1-4]
- W2: [1-4]
- X3: [1-4]
```
Output:
@ -168,19 +176,20 @@ Output:
[Source](tutorial05.yml):
connectors:
```yaml
connectors:
X1:
pinout: [+12V, GND, GND, +5V]
type: Molex 8981
subtype: female
ferrules: # ferrules
ferrules: # ferrules
F1:
type: Ferrule, crimp
subtype: 0.5 mm²
color: OG # optional color
cables:
cables:
W1:
category: bundle # bundle
length: 0.3
@ -188,13 +197,14 @@ Output:
colors: [YE, BK, BK, RD] # custom colors, wirecount is implicit
notes: hello!
connections:
connections:
- # attach ferrules
- F1
- W1: [1-4] # a new ferrule is auto-generated for each wire
- # attach connectors (separetely from ferrules)
- W1: [1-4]
- X1: [1-4]
```
Output:
@ -208,7 +218,8 @@ Output:
[Source](tutorial06.yml):
connectors:
```yaml
connectors:
X1:
pinout: [+12V, GND, GND, +5V]
type: Molex 8981
@ -219,20 +230,20 @@ Output:
subtype: 1.0 mm²
color: YE
ferrules: # ferrules
ferrules: # ferrules
F_05:
type: Ferrule, crimp
subtype: 0.5 mm²
color: OG # optional color
cables:
cables:
W1:
category: bundle # budnle
length: 0.3
gauge: 0.5 mm
colors: [YE, BK, BK, RD] # custom colors, wirecount is implicit
connections:
connections:
- # attach ferrules
- F_05
- W1: [1,4] # a new ferrule is auto-generated for each wire
@ -246,6 +257,7 @@ Output:
-
- F_10_1: 1
- W1: 3
```
Output:
@ -258,7 +270,8 @@ Output:
[Source](tutorial07.yml):
connectors:
```yaml
connectors:
X1: &template_con
type: Molex KK 254
subtype: female
@ -274,7 +287,7 @@ Output:
X6:
<<: *template_con
cables:
cables:
W1: &template_wire
gauge: 0.25 mm2
length: 0.2
@ -289,7 +302,7 @@ Output:
W5:
<<: *template_wire
connections:
connections:
-
- X1: [1-4]
- W1: [1-4]
@ -310,6 +323,7 @@ Output:
- X5: [1-4]
- W5: [1-4]
- X6: [1-4]
```
Output: