mirror of
https://github.com/python/cpython.git
synced 2024-11-25 19:03:49 +08:00
Don't attempt to add paragraph and subparagraph sections to the PDF
outline. Work around font-long bogosity caused by ' in docstring.
This commit is contained in:
parent
56440a58f7
commit
8c1e114d1a
@ -3,7 +3,7 @@
|
|||||||
"""Convert a LaTeX .toc file to some PDFTeX magic to create that neat outline.
|
"""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
|
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
|
import getopt
|
||||||
@ -41,6 +41,9 @@ _transition_map = {
|
|||||||
('subsubsection', 'chapter'): 3,
|
('subsubsection', 'chapter'): 3,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
INCLUDED_LEVELS = ("chapter", "section", "subsection", "subsubsection")
|
||||||
|
|
||||||
|
|
||||||
def parse_toc(fp, bigpart=None):
|
def parse_toc(fp, bigpart=None):
|
||||||
toc = top = []
|
toc = top = []
|
||||||
stack = [toc]
|
stack = [toc]
|
||||||
@ -59,6 +62,9 @@ def parse_toc(fp, bigpart=None):
|
|||||||
if stype == level:
|
if stype == level:
|
||||||
toc.append(entry)
|
toc.append(entry)
|
||||||
else:
|
else:
|
||||||
|
if stype not in INCLUDED_LEVELS:
|
||||||
|
# we don't want paragraphs & subparagraphs
|
||||||
|
continue
|
||||||
direction = _transition_map[(level, stype)]
|
direction = _transition_map[(level, stype)]
|
||||||
if direction == OUTER_TO_INNER:
|
if direction == OUTER_TO_INNER:
|
||||||
toc = toc[-1][-1]
|
toc = toc[-1][-1]
|
||||||
|
Loading…
Reference in New Issue
Block a user