Updated docs generation scripts
This commit is contained in:
@@ -38,8 +38,11 @@ ok = 0
|
||||
for f in files:
|
||||
try:
|
||||
print(f'Generating Mermaid diagram from {f}')
|
||||
f_svg = Path(f).with_suffix('.svg')
|
||||
subprocess.check_call(['mmdc', '-i', f, '-o', f_svg])
|
||||
f_svg = Path(f).with_suffix('.svg').name
|
||||
target = Path(f).parent.absolute()
|
||||
target = target.joinpath('mermaid')
|
||||
target = target.joinpath(f_svg)
|
||||
subprocess.check_call(['mmdc', '-i', f, '-o', target])
|
||||
except subprocess.CalledProcessError:
|
||||
ok = 1
|
||||
print(f'ERROR: Generating Mermaid diagram from {f} failed')
|
||||
|
||||
@@ -71,20 +71,21 @@ with open(r'tests/test_cases.yaml') as f:
|
||||
config_dict = yaml.full_load(config)
|
||||
tc.write("## Generated PlantUML diagrams\n")
|
||||
for diagram_name, _ in config_dict['diagrams'].items():
|
||||
copyfile(f'debug/tests/diagrams/puml/{diagram_name}.svg',
|
||||
copyfile(f'debug/tests/diagrams/plantuml/{diagram_name}.svg',
|
||||
f'docs/test_cases/{diagram_name}.svg')
|
||||
tc.write(f'\n')
|
||||
|
||||
tc.write("## Generated Mermaid diagrams\n")
|
||||
for diagram_name, _ in config_dict['diagrams'].items():
|
||||
copyfile(f'debug/tests/diagrams/mermaid/{diagram_name}.svg',
|
||||
f'docs/test_cases/{diagram_name}_mmd.svg')
|
||||
tc.write(f'\n')
|
||||
f'docs/test_cases/{diagram_name}_mermaid.svg')
|
||||
tc.write(f'\n')
|
||||
|
||||
tc.write("## Generated JSON models\n")
|
||||
for diagram_name, _ in config_dict['diagrams'].items():
|
||||
if os.path.exists(f'debug/tests/puml/{diagram_name}.json'):
|
||||
with open(f'debug/tests/puml/{diagram_name}.json') as f:
|
||||
jd = f'debug/tests/diagrams/{diagram_name}.json'
|
||||
if os.path.exists(jd):
|
||||
with open(jd) as f:
|
||||
contents = f.read()
|
||||
tc.write("```json\n")
|
||||
tc.write(contents)
|
||||
|
||||
Reference in New Issue
Block a user