at main 41 lines 735 B view raw
1#! /usr/bin/env python3 2"""Render graph.""" 3 4from pathlib import Path 5 6from rwx.fs import make_directory, read_file_text, write 7from rwx.ps import run 8 9if __name__ == "__main__": 10 root = Path(__file__).parent 11 out = root / "out" / "web" 12 gv = root / "index.gv" 13 svg = out / "index.svg" 14 make_directory(out) 15 run("dot", str(gv), "-Tsvg", "-o", str(svg)) 16 text = read_file_text(svg) 17 write( 18 out / "index.css", 19 """\ 20html { 21background-color: #202020; 22} 23""", 24 ) 25 write( 26 out / "index.html", 27 f"""\ 28<!DOCTYPE html> 29<html><head> 30 31<meta charset="UTF-8"> 32<link rel="stylesheet" href="index.css"> 33<title>work.marc.beninca.link</title> 34 35</head><body> 36 37{text} 38 39</body></html> 40""", 41 )