Mercurial > hg > kdocs
view make/manlifter.patch @ 1:34a037d461f9
Some random infrastructure to build documentation from source.
author | Rob Landley <rob@landley.net> |
---|---|
date | Wed, 20 Jun 2007 00:26:29 -0400 |
parents | |
children |
line wrap: on
line source
--- doclifter-2.3/manlifter 2006-12-25 02:43:35.000000000 -0500 +++ new/manlifter 2007-05-24 22:38:22.000000000 -0400 @@ -359,6 +359,7 @@ for (root, dirs, files) in os.walk('xmlman'): for file in files: try: + if not file.endswith(".xml"): continue # Extract the manual section m = section_re.search(root) if m: @@ -367,7 +368,7 @@ continue section_dict[section] = [] # Extract the manual page name - name = ".".join(file.split(".")[:-2]) + name = ".".join(file.split(".")[:-1]) # Extract the description file = os.path.join(root, file) fp = open(file) @@ -379,21 +380,21 @@ else: description = "(no description)" # Build an index entry - filelist.append((section, file, name, description)) + filelist.append((section, name, description)) except IOError: pass filelist.sort() # In case the directory was pieced together by several runs - for (section, file, name, description) in filelist: - section_dict[section].append((file, name, description)) + for (section, name, description) in filelist: + section_dict[section].append((name, description)) keys = section_dict.keys() keys.sort() for section in keys: ofp.write(htmlheader) ofp.write("<h1>%s:</h1>\n<dl>\n" % section) - for (file, name, description) in section_dict[section]: - ofp.write("<dt><a href='%s'>%s</a></dt><dd>%s</dd>\n" \ - % (file, name, description)) + for (name, description) in section_dict[section]: + ofp.write("<dt><a href='man%s/%s.html'>%s</a></dt><dd>%s</dd>\n" \ + % (section, name, name, description)) ofp.write("</dl>\n") ofp.write(htmltrailer) @@ -503,7 +504,7 @@ def doclifter_driver(options, arguments): "Lift old markup to new." - global makehtml, outdir, xslfragment, patchdir + global mandir, makehtml, outdir, xslfragment, patchdir filelist = [] sections = [] callopts = "" @@ -567,9 +568,10 @@ fp.close() massrun(filelist, callopts) else: - global processed - processed = sets.Set(map(lambda x: x.replace(".patch", "").replace(".correction", ""), os.listdir(patchdir))) - massrun(sectionfiles(sections), callopts) + global processed + if os.path.exists(patchdir): + processed = sets.Set(map(lambda x: x.replace(".patch", "").replace(".correction", ""), os.listdir(patchdir))) + massrun(sectionfiles(sections), callopts) if processed: print "# Patches not used:" for file in processed: