marc/build.py

28 lines
586 B
Python
Raw Normal View History

2023-03-28 19:29:54 +00:00
#! /usr/bin/env python3
import os
import subprocess
def run(*args):
subprocess.call(args)
def main():
root = os.path.dirname(os.path.realpath(__file__))
link_gv = os.path.join(root, 'link.gv')
link_svg = os.path.join(root, 'link.svg')
run('dot', link_gv, '-Tsvg', '-o', link_svg)
with open(link_svg, 'br') as f:
link_text = f.read().decode('u8')
page_file = os.path.join(root, 'test.html')
page_text = f'''\
{link_text}
'''
with open(page_file, 'bw') as f:
f.write(page_text.encode('u8'))
if __name__ == '__main__':
main()