Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8c1e114

Browse files
committed
Don't attempt to add paragraph and subparagraph sections to the PDF
outline. Work around font-long bogosity caused by ' in docstring.
1 parent 56440a5 commit 8c1e114

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

Doc/tools/toc2bkm.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""Convert a LaTeX .toc file to some PDFTeX magic to create that neat outline.
44
55
The output file has an extension of '.bkm' instead of '.out', since hyperref
6-
already uses that extension. Let's avoid clashing.
6+
already uses that extension.
77
"""
88

99
import getopt
@@ -41,6 +41,9 @@
4141
('subsubsection', 'chapter'): 3,
4242
}
4343

44+
INCLUDED_LEVELS = ("chapter", "section", "subsection", "subsubsection")
45+
46+
4447
def parse_toc(fp, bigpart=None):
4548
toc = top = []
4649
stack = [toc]
@@ -59,6 +62,9 @@ def parse_toc(fp, bigpart=None):
5962
if stype == level:
6063
toc.append(entry)
6164
else:
65+
if stype not in INCLUDED_LEVELS:
66+
# we don't want paragraphs & subparagraphs
67+
continue
6268
direction = _transition_map[(level, stype)]
6369
if direction == OUTER_TO_INNER:
6470
toc = toc[-1][-1]

0 commit comments

Comments
 (0)