#!/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() lines = lines.split("00-INDEX",1) if len(lines)==1: print "FAILED %s" % dir[0] continue # Open output, write header and
section (if any) out = open("%s/index.html" % dir[0], "w") out.write("\n%s \n\n
%s\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('\n') out.write('