-
Notifications
You must be signed in to change notification settings - Fork 0
/
doc.py
53 lines (37 loc) · 1.73 KB
/
doc.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
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/python
import json,os,subprocess
languages = ["en","de","eo"]
# Build the noun list documentation
NounJson = open(os.path.join("documentation","nounlist.json"),"r")
NounObj = json.load(NounJson)
NounHTML = open(os.path.join("documentation","nounlist.compoglot.html"),"w")
NounHTML.write("\n".join(NounObj["header"]))
NounHTML.write("\n\n\n")
for noun in NounObj["nouns"]:
NounHTML.write("<tr>\n")
NounHTML.write("<td>"+str(noun["id"])+"</td>\n")
NounHTML.write("<td>$<LANG{ sub[{n("+str(noun["id"])+",0,false)}] st(0,punc=0) }></td>\n")
NounHTML.write("<td></td><td></td>\n</tr>\n\n")
NounHTML.write("\n\n\n")
NounHTML.write("\n".join(NounObj["footer"]))
NounHTML.close()
# Build the verb list documentation
VerbJson = open(os.path.join("documentation","verblist.json"),"r")
VerbObj = json.load(VerbJson)
VerbHTML = open(os.path.join("documentation","verblist.compoglot.html"),"w")
VerbHTML.write("\n".join(VerbObj["header"]))
VerbHTML.write("\n\n\n")
for Verb in VerbObj["verbs"]:
VerbHTML.write("<tr>\n")
VerbHTML.write("<td>"+str(Verb["id"])+"</td>\n")
VerbHTML.write("<td>$<LANG{ Verb"+str(Verb["type"])+"("+str(Verb["id"])+") st(1,punc=0) }></td>\n<td>")
if ("examples" in Verb):
for example in Verb["examples"]:
VerbHTML.write("$<LANG{ " + example + " }><br/>")
VerbHTML.write("</td>\n<td></td>\n</tr>\n\n")
VerbHTML.write("\n\n\n")
VerbHTML.write("\n".join(VerbObj["footer"]))
VerbHTML.close()
for lang in languages:
subprocess.call(["compoglot","file",lang,os.path.join("documentation","nounlist.compoglot.html"),os.path.join("documentation","nounlist."+lang+".html")])
subprocess.call(["compoglot","file",lang,os.path.join("documentation","verblist.compoglot.html"),os.path.join("documentation","verblist."+lang+".html")])