forked from libre-chip/website
add WIP CPU architecture draft proposal
This commit is contained in:
parent
0442390142
commit
e9aaaec5f1
7 changed files with 202 additions and 3 deletions
26
scripts/mdbook-dia.py
Executable file
26
scripts/mdbook-dia.py
Executable file
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/env python3
|
||||
import json
|
||||
import sys
|
||||
import os
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
def main():
|
||||
if len(sys.argv) > 1:
|
||||
if sys.argv[1] == "supports":
|
||||
sys.exit(0)
|
||||
sys.exit(1)
|
||||
out = sys.stdout
|
||||
sys.stdout = sys.stderr
|
||||
context, book = json.load(sys.stdin)
|
||||
src: Path = Path(context["root"]) / context["config"]["book"]["src"]
|
||||
for root, dirs, files in os.walk(src):
|
||||
for file in files:
|
||||
file = Path(root) / file
|
||||
if file.suffix == ".dia":
|
||||
out_file = file.with_suffix(".dia.svg")
|
||||
subprocess.run(["dia", "-n", "-e", out_file, file], check=True)
|
||||
print(json.dumps(book), file=out)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Loading…
Add table
Add a link
Reference in a new issue