Mercurial > hg > kdocs
view 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 |
line wrap: on
line source
#!/usr/bin/python # Convert kernel Documentation/.../00-INDEX to index.html import os,sys for dir in os.walk("Documentation"): if not "00-INDEX" in dir[2]: continue # Read input lines = open("%s/00-INDEX" % dir[0]).read() # Open output, write header and <pre> section (if any) out = open("%s/index.html" % dir[0], "w") out.write("<html>\n<title>%s</title>\n<body>\n<ul>\n" % dir[0]) lines = lines.split("00-INDEX",1) if lines[0]: out.write("<pre>%s</pre>\n" % lines[0]) lines = lines[1].split("\n") lines[0] = "00-INDEX" close = 0 for idx in range(len(lines)): if not lines[idx]: continue if not lines[idx][0].isspace(): if close: out.write('</li>\n') out.write('<li><a href="%s">%s</a>' % (lines[idx].strip(), lines[idx].strip())) close = 1 else: out.write(" %s" % lines[idx].strip()) out.write("</li>\n</ul>\n</body>\n</html>\n")