Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f23431d

Browse files
committed
New script to convert the ACKS file to a nicely formatted HTML file.
Uses the new support module.
1 parent 01a110b commit f23431d

1 file changed

Lines changed: 62 additions & 0 deletions

File tree

Doc/tools/mkackshtml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#! /usr/bin/env python
2+
# -*- Python -*-
3+
4+
import support
5+
import sys
6+
7+
8+
def collect(fp):
9+
names = []
10+
while 1:
11+
line = fp.readline()
12+
if not line:
13+
break
14+
line = line.strip()
15+
if line:
16+
names.append(line)
17+
else:
18+
names = []
19+
return names
20+
21+
22+
def main():
23+
options = support.Options()
24+
options.columns = 4
25+
options.variables["title"] = "Acknowledgements"
26+
options.parse(sys.argv[1:])
27+
names = collect(sys.stdin)
28+
percol = (len(names) + options.columns - 1) / options.columns
29+
colnums = [percol*i for i in range(options.columns)]
30+
fp = options.get_output_file()
31+
print >>fp, options.get_header().rstrip()
32+
print >>fp, THANKS
33+
print >>fp, '<table width="100%" align="center">'
34+
for i in range(percol):
35+
print >>fp, " <tr>"
36+
for j in colnums:
37+
try:
38+
print >>fp, " <td>%s</td>" % names[i + j]
39+
except IndexError:
40+
print >>fp, " <td>&nbsp;</td>"
41+
print >>fp, " </tr>"
42+
print >>fp, "</table>"
43+
print >>fp, options.get_footer().rstrip()
44+
45+
46+
THANKS = '''\
47+
48+
<p>These people have contributed in some way to the Python
49+
documentation. This list is probably not complete -- if you feel that
50+
you or anyone else should be on this list, please let us know (send
51+
email to <a
52+
href="mailto:[email protected]">[email protected]</a>), and
53+
we will be glad to correct the problem.</p>
54+
55+
<p>It is only with the input and contributions of the Python community
56+
that Python has such wonderful documentation -- <b>Thank You!</b></p>
57+
58+
'''
59+
60+
61+
if __name__ == "__main__":
62+
main()

0 commit comments

Comments
 (0)