Kaydet (Commit) 0a0ef869 authored tarafından Fred Drake's avatar Fred Drake

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).
üst d7aa0f24
...@@ -48,6 +48,23 @@ class IndexOptions(support.Options): ...@@ -48,6 +48,23 @@ class IndexOptions(support.Options):
print __doc__ % {"program": program} print __doc__ % {"program": program}
class Node(buildindex.Node):
annotation = ""
def __init__(self, link, str, seqno):
parts = str.split(None, 1)
if parts[0].endswith("</tt>"):
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 '<tt class="module">%s</tt> %s' \
% (self.modname, self.annotation)
_rx = re.compile( _rx = re.compile(
"<dt><a href='(module-.*\.html)#l2h-\d+'><tt class='module'>" "<dt><a href='(module-.*\.html)#l2h-\d+'><tt class='module'>"
"([a-zA-Z_][a-zA-Z0-9_.]*</tt>(\s*<em>" "([a-zA-Z_][a-zA-Z0-9_.]*</tt>(\s*<em>"
...@@ -83,10 +100,7 @@ def main(): ...@@ -83,10 +100,7 @@ def main():
basename, modname = m.group(1, 2) basename, modname = m.group(1, 2)
has_plat_flag = has_plat_flag or m.group(3) has_plat_flag = has_plat_flag or m.group(3)
linkfile = os.path.join(dirname, basename) linkfile = os.path.join(dirname, basename)
nodes.append(buildindex.Node( nodes.append(Node('<a href="%s">' % linkfile, modname, seqno))
'<a href="%s">' % linkfile,
"<tt class=module>%s</tt>" % modname,
seqno))
seqno = seqno + 1 seqno = seqno + 1
ifp.close() ifp.close()
# #
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment