From 7f492ad7b89de798bbb6d4b5f2872cd00f36cfbc Mon Sep 17 00:00:00 2001 From: Fred Drake Date: Tue, 2 Mar 1999 16:22:56 +0000 Subject: [PATCH] Be more flexible to support platform annotations. --- Doc/tools/mkmodindex | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/Doc/tools/mkmodindex b/Doc/tools/mkmodindex index 893771e3146..16aa109e656 100755 --- a/Doc/tools/mkmodindex +++ b/Doc/tools/mkmodindex @@ -10,7 +10,8 @@ import sys _rx = re.compile( - '
([a-zA-Z_][a-zA-Z0-9_.]*)') + '
' + '([a-zA-Z_][a-zA-Z0-9_.]*(\s*\(.*\))?)') def main(): outputfile = "-" @@ -32,6 +33,7 @@ def main(): # nodes = [] seqno = 0 + has_plat_flag = 0 for ifn in args: if ifn == "-": ifp = sys.stdin @@ -47,14 +49,23 @@ def main(): if m: # This line specifies a module! 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(buildindex.Node( + '' % linkfile, + "%s" % modname, + seqno)) seqno = seqno + 1 ifp.close() + # + # Generate all output: + # num_nodes = len(nodes) - html = HEAD + buildindex.process_nodes(nodes, columns, letters) + TAIL + # Here's the HTML generation: + parts = [HEAD, buildindex.process_nodes(nodes, columns, letters), TAIL] + if has_plat_flag: + parts.insert(1, PLAT_DISCUSS) + html = string.join(parts, '') program = os.path.basename(sys.argv[0]) if outputfile == "-": sys.stdout.write(html) @@ -97,6 +108,15 @@ HEAD = """\ Up: Python Documentation Index

+ +

Global Module Index

+ +""" + +PLAT_DISCUSS = """ +

Some module names are followed by an annotation indicating what +platform they are available on.

+ """ TAIL = """