summaryrefslogtreecommitdiff
path: root/macros/luatex/optex/base/maketoc.opm
diff options
context:
space:
mode:
Diffstat (limited to 'macros/luatex/optex/base/maketoc.opm')
-rw-r--r--macros/luatex/optex/base/maketoc.opm15
1 files changed, 9 insertions, 6 deletions
diff --git a/macros/luatex/optex/base/maketoc.opm b/macros/luatex/optex/base/maketoc.opm
index f94571629e..46a2f8d50f 100644
--- a/macros/luatex/optex/base/maketoc.opm
+++ b/macros/luatex/optex/base/maketoc.opm
@@ -3,7 +3,7 @@
\_codedecl \maketoc {Macros for maketoc <2020-03-12>} % preloaded in format
\_doc ------------------------------------
- \`\_Xtoc` `{<level>}{<type>}{<number>}{<title>}` (in `.ref` file) reads the
+ \`\_Xtoc` `{<level>}{<type>}{<number>}<title>` (in `.ref` file) reads the
specified data and appends them to the \`\_toclist` as
\^`\_tocline``{<level>}{<type>}{<number>}{<title>}{<gpageno>}{<pageno>}`
where:
@@ -17,15 +17,17 @@
\enditems
The last two parameters are restored from previous
\^`\_Xpage``{<pageno>}{<gpageno>}`, data were saved in the \^`\_currpage` macro.
+
+ We read the <title> parameter by \^`\scantoeol` from `.ref` file
+ because the <title> can include something like \code{`\{`}.
\_cod ------------------------------------
\_def\_toclist{}
\_newifi \_ifischap \_ischapfalse
-\_def\_Xtoc#1#2#3#4{\_ifnum#1=0 \_ischaptrue\_fi
- \_addto\_toclist{\_tocline{#1}{#2}{#3}{#4}}
- \_ea\_addto\_ea\_toclist\_ea{\_currpage}%
-}
+\_def\_Xtoc#1#2#3{\_ifnum#1=0 \_ischaptrue\_fi
+ \_addto\_toclist{\_tocline{#1}{#2}{#3}}\_scantoeol\_XtocA}
+\_def\_XtocA#1{\_addto\_toclist{{#1}}\_ea\_addto\_ea\_toclist\_ea{\_currpage}}
\_doc ------------------------------------
\`\_tocline``{<level>}{<type>}{<number>}{<title>}{<gpageno>}{<pageno>}` prints
@@ -59,7 +61,7 @@
\_def\_pgn{\_ilink[pg:#5]}%
\_the\_everytocline
\_ifcsname _tocl:#1\_endcsname
- \_cs{_tocl:#1}{#3}{#4}{#6}\_par
+ \_cs{_tocl:#1}{#3}{\_scantextokens{#4}}{#6}\_par
\_fi
\_egroup
}
@@ -100,6 +102,7 @@
\_def\_maketoc{\_par \_ifx\_toclist\_empty
\_opwarning{\_noexpand\maketoc -- data unavailable, TeX me again}\_openref
+ \_incr\_unresolvedrefs
\_else \_begingroup
\_tocrefnum=0 \_penalty11333
\_the\_regtoc \_toclist