forked from multigcs/viaconstructor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelp_gen.py
40 lines (30 loc) · 1.2 KB
/
help_gen.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import json
helpdata = json.loads(open("docs/help.json", "r").read())
index = []
index.append("<h1>Help</h1>")
index.append("<hr />")
index.append("<center>")
index.append('<table width="90%" border="0">')
for name, data in helpdata.items():
# index.append(f"<a href=\"{name}.html\">{data['title']}</a><br />")
index.append('<tr><td valign="top" align="left">')
index.append(f"<h2>{data['title']}</h2>")
index.append(data["text"])
index.append('<br /></td><td valign="top" align="right">')
for option, filename in data["images"].items():
index.append(f"{option}")
index.append(
f'<a href="../{filename}"><img width="320" alt="{option}" src="../{filename}" /></a><br />'
)
index.append("</td></tr>")
index.append("<tr><td><br /></td><td></td></tr>")
html = []
html.append(f"<h1>{data['title']}</h1>")
html.append(data["text"])
html.append("<br />")
for option, filename in data["images"].items():
html.append(f'<img width="320" src="../{filename}" />')
open(f"docs/help/{name}.html", "w").write("\n".join(html))
index.append("</table>")
index.append("</center>")
open(f"docs/help/index.html", "w").write("\n".join(index))