summaryrefslogtreecommitdiffstats
path: root/Doc/tools/buildindex.py
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>1999-02-24 16:36:48 (GMT)
committerFred Drake <fdrake@acm.org>1999-02-24 16:36:48 (GMT)
commit711fe02ac38c6e5a2f784b2f8a083c7ea7f18a33 (patch)
tree799a7c7d1630ec23a01782c417d4c597b61ad2eb /Doc/tools/buildindex.py
parent4fe6caaaf082429e778a09043f6dce78b253b701 (diff)
downloadcpython-711fe02ac38c6e5a2f784b2f8a083c7ea7f18a33.zip
cpython-711fe02ac38c6e5a2f784b2f8a083c7ea7f18a33.tar.gz
cpython-711fe02ac38c6e5a2f784b2f8a083c7ea7f18a33.tar.bz2
process_nodes(): New function.
main(): Moved the node processing between input and ouptut to process_nodes().
Diffstat (limited to 'Doc/tools/buildindex.py')
-rwxr-xr-xDoc/tools/buildindex.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/Doc/tools/buildindex.py b/Doc/tools/buildindex.py
index 644ec43..81bd311 100755
--- a/Doc/tools/buildindex.py
+++ b/Doc/tools/buildindex.py
@@ -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)