]> granicus.if.org Git - python/commitdiff
parse_line(): Strip whitespace from the module name.
authorFred Drake <fdrake@acm.org>
Fri, 13 Feb 1998 05:11:05 +0000 (05:11 +0000)
committerFred Drake <fdrake@acm.org>
Fri, 13 Feb 1998 05:11:05 +0000 (05:11 +0000)
main():  Include a comma between the module name and page number, to make
 the generated index more like the "standard" generated index.

Doc/modindex.py
Doc/tools/modindex.py

index f85b909ddabc752de0c9541f0fcee479af58a7cd..84c106608fa11288ed5cb190427578f4399bb9ed 100755 (executable)
@@ -9,9 +9,8 @@ import sys
 
 def parse_line(input):
     lineno = string.split(input)[-1]
-    module = input[:len(input)-(len(lineno)+1)]
+    module = string.strip(input[:len(input)-(len(lineno)+1)])
     return module, lineno
-    return 
 
 
 def cmp_items((s1, line1), (s2, line2)):
@@ -54,7 +53,7 @@ def main():
        if string.lower(module[0]) != prev_letter:
            ofp.write("\n  \\indexspace\n\n")
            prev_letter = string.lower(module[0])
-       ofp.write("  \\item {\\tt %s} %s\n" % (module, lineno))
+       ofp.write("  \\item {\\tt %s}, %s\n" % (module, lineno))
     ofp.write("\n\\end{theindex}\n")
 
 
index f85b909ddabc752de0c9541f0fcee479af58a7cd..84c106608fa11288ed5cb190427578f4399bb9ed 100755 (executable)
@@ -9,9 +9,8 @@ import sys
 
 def parse_line(input):
     lineno = string.split(input)[-1]
-    module = input[:len(input)-(len(lineno)+1)]
+    module = string.strip(input[:len(input)-(len(lineno)+1)])
     return module, lineno
-    return 
 
 
 def cmp_items((s1, line1), (s2, line2)):
@@ -54,7 +53,7 @@ def main():
        if string.lower(module[0]) != prev_letter:
            ofp.write("\n  \\indexspace\n\n")
            prev_letter = string.lower(module[0])
-       ofp.write("  \\item {\\tt %s} %s\n" % (module, lineno))
+       ofp.write("  \\item {\\tt %s}, %s\n" % (module, lineno))
     ofp.write("\n\\end{theindex}\n")