Auto-generate example gallery
This commit is contained in:
parent
8aeabd03c3
commit
d86ec0ad68
25
examples/readme.md
Normal file
25
examples/readme.md
Normal file
@ -0,0 +1,25 @@
|
||||
# Example gallery
|
||||
## Example 01
|
||||

|
||||
|
||||
[Source](ex01.yml)
|
||||
|
||||
|
||||
## Example 02
|
||||

|
||||
|
||||
[Source](ex02.yml)
|
||||
|
||||
|
||||
## Example 03
|
||||

|
||||
|
||||
[Source](ex03.yml)
|
||||
|
||||
|
||||
## Example 04
|
||||

|
||||
|
||||
[Source](ex04.yml)
|
||||
|
||||
|
||||
13
readme.md
13
readme.md
@ -23,7 +23,9 @@ WireViz is a simple yet flexible, YAML-based markup language for documenting cab
|
||||
|
||||
_Note_: WireViz is not designed to represent the complete wiring of a system. Its main aim is to document the construction of individual wires and harnesses.
|
||||
|
||||
## Demo
|
||||
## Examples
|
||||
|
||||
### Demo 01
|
||||
|
||||
[WireViz input file](examples/demo01.yml):
|
||||
|
||||
@ -61,15 +63,20 @@ Output file:
|
||||
|
||||

|
||||
|
||||
[Example 2](examples/demo02.yml)
|
||||
### Demo 02
|
||||
|
||||

|
||||
|
||||
[Source](examples/demo02.yml)
|
||||
|
||||
### More examples
|
||||
|
||||
See the [example gallery](examples/) and included readme file.
|
||||
|
||||
## Status
|
||||
|
||||
This is very much a [work in progress](todo.md).
|
||||
|
||||
|
||||
## License
|
||||
|
||||
GNU GPLv3
|
||||
|
||||
12
src/batch.py
12
src/batch.py
@ -1,11 +1,21 @@
|
||||
import wireviz
|
||||
import os
|
||||
|
||||
# TODO: make examples (progressively more complex), batch process all of them
|
||||
readme = '../examples/readme.md'
|
||||
readme = os.path.abspath(readme)
|
||||
|
||||
with open(readme, 'w') as file:
|
||||
file.write('# Example gallery\n')
|
||||
for i in range(1,3):
|
||||
fn = '../examples/demo{:02d}.yml'.format(i)
|
||||
print(fn)
|
||||
wireviz.parse(fn)
|
||||
|
||||
for i in range(1,5):
|
||||
fn = '../examples/ex{:02d}.yml'.format(i)
|
||||
print(fn)
|
||||
wireviz.parse(fn)
|
||||
|
||||
file.write('## Example {:02d}\n'.format(i))
|
||||
file.write('\n\n'.format(i))
|
||||
file.write('[Source](ex{:02d}.yml)\n\n\n'.format(i))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user