Mercurial > hg > kdocs
changeset 18:31787234d021
Add a script to convert 00-INDEX files to index.html, and add comments.
author | Rob Landley <rob@landley.net> |
---|---|
date | Thu, 09 Aug 2007 15:05:22 -0500 |
parents | 6b8d10c36bff |
children | a6a6640500ae |
files | make/docdiridx.py make/fixlinks.py |
diffstat | 2 files changed, 37 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/docdiridx.py Thu Aug 09 15:05:22 2007 -0500 @@ -0,0 +1,34 @@ +#!/usr/bin/python + +# Convert kernel Documentation/.../00-INDEX to index.html + +import os,sys + +if len(sys.argv)==1: + print "Usage: docdiridx.py `find Documentation -name 00-INDEX`" + sys.exit(1) + +for name in sys.argv[1:]: + # Read input + + name = "/".join(name.split("/")[:-1]) + lines = open("%s/00-INDEX" % name).read() + + # Open output, write header and <pre> section (if any) + out = open("%s/index.html" % name, "w") + out.write("<html>\n<title>%s</title>\n<body>\n<ul>\n" % sys.argv[1]) + lines = lines.split("00-INDEX",1) + if lines[0]: out.write("<pre>%s</pre>\n" % lines[0]) + lines = lines[1].split("\n") + lines = map(lambda a: a.strip(), lines) + lines[0] = "00-INDEX" + + idx = 0 + while idx<len(lines): + if not lines[idx]: + idx += 1 + continue + out.write('<li><a href="%s">%s</a> %s</li>\n' % (lines[idx], lines[idx], lines[idx+1])) + idx += 2 + out.write("</ul>\n</body>\n</html>\n") +
--- a/make/fixlinks.py Fri Aug 03 20:12:51 2007 -0500 +++ b/make/fixlinks.py Thu Aug 09 15:05:22 2007 -0500 @@ -1,5 +1,8 @@ #!/usr/bin/python +# Convert the absolute paths in the symlinks of manlifter's html translation +# of the man-pages into portable relative paths. + import os, sys for i in sys.argv[1:]: