]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
process_nodes(): New function.
authorFred Drake <fdrake@acm.org>
Wed, 24 Feb 1999 16:36:48 +0000 (16:36 +0000)
committerFred Drake <fdrake@acm.org>
Wed, 24 Feb 1999 16:36:48 +0000 (16:36 +0000)
main():  Moved the node processing between input and ouptut to
 process_nodes().

Doc/tools/buildindex.py

index 644ec4351f6b84b100bd42d98d4404e58b15b8a7..81bd311d0307f7afbf427c96bc2d6f4f91b0b0af 100755 (executable)
@@ -286,6 +286,15 @@ def dump(nodes, fp):
         fp.write(node.dump())
 
 
+def process_nodes(nodes, columns, letters):
+    nodes.sort()
+    collapse(nodes)
+    if letters:
+        return format_html_letters(nodes, columns)
+    else:
+        return format_html(nodes, columns)
+
+
 def main():
     import getopt
     ifn = "-"
@@ -307,12 +316,7 @@ def main():
     for fn in args:
         nodes = nodes + load(open(fn))
     num_nodes = len(nodes)
-    nodes.sort()
-    collapse(nodes)
-    if letters:
-        html = format_html_letters(nodes, columns)
-    else:
-        html = format_html(nodes, columns)
+    html = process_nodes(nodes, columns, letters)
     program = os.path.basename(sys.argv[0])
     if ofn == "-":
         sys.stdout.write(html)