From: Fred Drake Date: Tue, 28 Nov 2000 16:20:50 +0000 (+0000) Subject: Use a subclass of buildindex.Node to clean up the HTML and get the X-Git-Tag: v2.1a1~703 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0a0ef8696b560dd03a9619820dad255b34ef7423;p=python Use a subclass of buildindex.Node to clean up the HTML and get the ordering fixed up (this makes sure that "xml.dom" comes before "xml.dom.minidom" in the Module Index, which was not true before because some HTML cruft crept into the data structures). --- diff --git a/Doc/tools/mkmodindex b/Doc/tools/mkmodindex index 257e30aa01..3bc4b956ea 100755 --- a/Doc/tools/mkmodindex +++ b/Doc/tools/mkmodindex @@ -48,6 +48,23 @@ class IndexOptions(support.Options): print __doc__ % {"program": program} +class Node(buildindex.Node): + annotation = "" + + def __init__(self, link, str, seqno): + parts = str.split(None, 1) + if parts[0].endswith(""): + self.modname = parts[0][:-5] + else: + self.modname = parts[0] + if len(parts) == 2: + self.annotation = parts[1] + buildindex.Node.__init__(self, link, self.modname, seqno) + + def __str__(self): + return '%s %s' \ + % (self.modname, self.annotation) + _rx = re.compile( "
" "([a-zA-Z_][a-zA-Z0-9_.]*(\s*" @@ -83,10 +100,7 @@ def main(): basename, modname = m.group(1, 2) has_plat_flag = has_plat_flag or m.group(3) linkfile = os.path.join(dirname, basename) - nodes.append(buildindex.Node( - '' % linkfile, - "%s" % modname, - seqno)) + nodes.append(Node('' % linkfile, modname, seqno)) seqno = seqno + 1 ifp.close() #