# HG changeset patch # User Rob Landley # Date 1192619196 18000 # Node ID 75251bfa6b338be0413d4834ef3037549b688985 # Parent baf5a8bc72a0d51abd2fcaae65913a795ea95955 Teach indexsections.py to produce debugging output when necessary. diff -r baf5a8bc72a0 -r 75251bfa6b33 make/indexsections.py --- 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 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)