]> granicus.if.org Git - python/commitdiff
Don't attempt to add paragraph and subparagraph sections to the PDF
authorFred Drake <fdrake@acm.org>
Wed, 7 Oct 1998 14:12:20 +0000 (14:12 +0000)
committerFred Drake <fdrake@acm.org>
Wed, 7 Oct 1998 14:12:20 +0000 (14:12 +0000)
outline.

Work around font-long bogosity caused by ' in docstring.

Doc/tools/toc2bkm.py

index 0a17f46d13b2e11c892f1b1e4bee90dbad3e96a5..ca7064be927733f2a826c3e6be929dea6465bf00 100755 (executable)
@@ -3,7 +3,7 @@
 """Convert a LaTeX .toc file to some PDFTeX magic to create that neat outline.
 
 The output file has an extension of '.bkm' instead of '.out', since hyperref
-already uses that extension.  Let's avoid clashing.
+already uses that extension.
 """
 
 import getopt
@@ -41,6 +41,9 @@ _transition_map = {
     ('subsubsection', 'chapter'): 3,
     }
 
+INCLUDED_LEVELS = ("chapter", "section", "subsection", "subsubsection")
+
+
 def parse_toc(fp, bigpart=None):
     toc = top = []
     stack = [toc]
@@ -59,6 +62,9 @@ def parse_toc(fp, bigpart=None):
            if stype == level:
                toc.append(entry)
            else:
+                if stype not in INCLUDED_LEVELS:
+                    # we don't want paragraphs & subparagraphs
+                    continue
                direction = _transition_map[(level, stype)]
                if direction == OUTER_TO_INNER:
                    toc = toc[-1][-1]