Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 56440a5 commit 8c1e114Copy full SHA for 8c1e114
1 file changed
Doc/tools/toc2bkm.py
@@ -3,7 +3,7 @@
3
"""Convert a LaTeX .toc file to some PDFTeX magic to create that neat outline.
4
5
The output file has an extension of '.bkm' instead of '.out', since hyperref
6
-already uses that extension. Let's avoid clashing.
+already uses that extension.
7
"""
8
9
import getopt
@@ -41,6 +41,9 @@
41
('subsubsection', 'chapter'): 3,
42
}
43
44
+INCLUDED_LEVELS = ("chapter", "section", "subsection", "subsubsection")
45
+
46
47
def parse_toc(fp, bigpart=None):
48
toc = top = []
49
stack = [toc]
@@ -59,6 +62,9 @@ def parse_toc(fp, bigpart=None):
59
62
if stype == level:
60
63
toc.append(entry)
61
64
else:
65
+ if stype not in INCLUDED_LEVELS:
66
+ # we don't want paragraphs & subparagraphs
67
+ continue
68
direction = _transition_map[(level, stype)]
69
if direction == OUTER_TO_INNER:
70
toc = toc[-1][-1]
0 commit comments