comparison make/docdiridx.py @ 57:999825a029ee

Found a second multiline 00-INDEX entry (first in powerpc, second in networking), so teach the script to handle those.
author Rob Landley <rob@landley.net>
date Sun, 30 Sep 2007 23:30:38 -0500
parents b5481d0c89c1
children 09c09067584c
comparison
equal deleted inserted replaced
56:7fa04e9d3e4b 57:999825a029ee
15 out = open("%s/index.html" % dir[0], "w") 15 out = open("%s/index.html" % dir[0], "w")
16 out.write("<html>\n<title>%s</title>\n<body>\n<ul>\n" % dir[0]) 16 out.write("<html>\n<title>%s</title>\n<body>\n<ul>\n" % dir[0])
17 lines = lines.split("00-INDEX",1) 17 lines = lines.split("00-INDEX",1)
18 if lines[0]: out.write("<pre>%s</pre>\n" % lines[0]) 18 if lines[0]: out.write("<pre>%s</pre>\n" % lines[0])
19 lines = lines[1].split("\n") 19 lines = lines[1].split("\n")
20 lines = map(lambda a: a.strip(), lines)
21 lines[0] = "00-INDEX" 20 lines[0] = "00-INDEX"
22 21
23 idx = 0 22 close = 0
24 while idx<len(lines): 23 for idx in range(len(lines)):
25 if not lines[idx]: 24 if not lines[idx]: continue
26 idx += 1 25 if not lines[idx][0].isspace():
27 continue 26 if close: out.write('</li>\n')
28 out.write('<li><a href="%s">%s</a> %s</li>\n' % (lines[idx], lines[idx], lines[idx+1])) 27 out.write('<li><a href="%s">%s</a>' % (lines[idx].strip(), lines[idx].strip()))
29 idx += 2 28 close = 1
30 out.write("</ul>\n</body>\n</html>\n") 29 else: out.write(" %s" % lines[idx].strip())
31 30 out.write("</li>\n</ul>\n</body>\n</html>\n")