changeset 76:75251bfa6b33

Teach indexsections.py to produce debugging output when necessary.
author Rob Landley <rob@landley.net>
date Wed, 17 Oct 2007 06:06:36 -0500
parents baf5a8bc72a0
children 27dcbe1b4669
files make/indexsections.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/make/indexsections.py	Wed Oct 17 05:37:22 2007 -0500
+++ b/make/indexsections.py	Wed Oct 17 06:06:36 2007 -0500
@@ -2,6 +2,8 @@
 
 import os,sys
 
+debug = 0
+
 # Print appropriate number of <ul> or </ul> tags, with indentation.
 def adjust_depth(newdepth, depth):
   while newdepth > depth:
@@ -41,6 +43,7 @@
         sys.exit(1)
       tag = tag[1][3:]
       if tag[0]=='"' and tag[-1]=='"': tag=tag[1:-1]
+      if debug: sys.stderr.write("tag %s\n" % tag)
       spans.append("_".join(tag.split()))
       secnum[-1] += 1
       secstr = ".".join(map(lambda a: str(a), secnum))
@@ -61,13 +64,15 @@
     # End of a section, pop it off the stack.
 
     elif tag[0] == "/span":
-      spans.pop()
+      if debug: sys.stderr.write("pop %s\n" % spans.pop())
+      else: spans.pop()
       secnum.pop()
 
     # This tag wasn't one of ours, so output it verbatim.  (It's HTML.)
 
     else:
       if not idx: sys.stdout.write('<%s>%s' % (i[0], i[1]));
+    if debug: sys.stderr.write("i=%s\n" % i)
     line += i[1].count("\n")
   if idx: adjust_depth(0, depth)