forked from asl2/PyZ3950
-
Notifications
You must be signed in to change notification settings - Fork 1
/
mkdoc.py
executable file
·75 lines (51 loc) · 1.73 KB
/
mkdoc.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env python
"""Hackish code to generate online web page documentation. At some
point I should replace this with a more standard solution."""
import hacked_pydoc as pydoc
import vers
mydir = 'PyZ3950/'
fil = open (mydir + 'index.html', "w")
def echo_file (fil,fn, repl = 0):
f = open (fn)
s = f.read ()
if repl:
s = s.replace ("$version$", str (vers.version))
fil.write (s)
def do_header (fil, s):
fil.write ("<H1>" + s + "</H1>")
echo_file (fil, 'header', repl = 1)
mod_dict = {}
mydir = 'PyZ3950/'
def do_pydoc (fil,modname, write_link = 0):
pydoc.writedoc (mydir + modname)
if write_link:
fil.write("""<p><a href="%s.html">Link to pydoc documentation for %s
implementation (recommended interface).</a>""" % (
modname, modname))
def do_dummy_pydoc (modname):
hdr = """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html><head><title>PyZ3950 - Python Z39.50 and ASN.1 BER implementations
</title></head><body>"""
f = open (mydir + modname + ".html", "w")
f.write (hdr)
f.write ('<p>Documentation is available in the <a href="./index.html">' +
'main file</a>.')
f.write ('</body></html>')
f.close ()
def do_imp (modname):
mod_dict [modname] = __import__ (mydir + modname)
do_header (fil, 'ZOOM')
mainmod = 'zoom'
do_pydoc (fil,mainmod, 1)
for mod in ['ccl', 'grs1', 'zmarc','bib1msg', 'CQLParser', 'SRWDiagnostics',
'c2query', 'oids', 'pqf']:
do_pydoc (fil, mod)
NamesList = ['z3950','asn1']
for n in NamesList:
do_dummy_pydoc (n)
for n in NamesList:
do_header (fil,n)
do_imp (n)
fil.write (mod_dict [n].__doc__)
echo_file (fil,'footer')