-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmake_documentation
executable file
·45 lines (35 loc) · 1.16 KB
/
make_documentation
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
#!/usr/bin/env python
import sys
docfor=""
if len(sys.argv)>=2 :
print "Making documentation for "+sys.argv[1]
docfor = "_for_"+sys.argv[1].replace("/","_").replace(".","_")
execfile(sys.argv[1])
else :
from textadv.basicsetup import *
print "loaded."
__oldout = sys.stdout
sys.stdout = open("doc/doc"+docfor+".html", "w")
html_escape_table = {
"&": "&",
'"': """,
"'": "'",
">": ">",
"<": "<",
}
def html_escape(text):
"""Produce entities within text."""
if text :
return "".join(html_escape_table.get(c,c) for c in text)
else :
return None
print "<html><body><h1>TextAdv auto-documentation</h1>"
print "<p>This is automagically generated documentation of the rules defined in the game engine.</p>"
world.make_documentation(html_escape, heading_level=1)
parser.make_documentation(html_escape, heading_level=1)
actionsystem.make_documentation(html_escape, heading_level=1)
actoractivities.make_documentation(html_escape, heading_level=1)
stringeval.make_documentation(html_escape, heading_level=1)
print "</body></html>"
sys.stdout = __oldout
print "outputted to","doc/doc"+docfor+".html"