From 07801f7ec3e3482aba8553fd75f9f190ac3f9f0a Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Fri, 13 Aug 2021 03:00:43 +0000
Subject: CTAN sync 202108130300

---
 web/pwebmac/pwebmac.tex | 46 +++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 39 insertions(+), 7 deletions(-)

(limited to 'web/pwebmac/pwebmac.tex')

diff --git a/web/pwebmac/pwebmac.tex b/web/pwebmac/pwebmac.tex
index 7f9972d21c..2eb713f8c0 100644
--- a/web/pwebmac/pwebmac.tex
+++ b/web/pwebmac/pwebmac.tex
@@ -160,8 +160,10 @@
   \else\if\noexpand\nxt\relax % we have a control sequence; is it one we know?
     \ifx\nxt~\addF\space
     \else\ifx\nxt\onespace\addF\space
-    \else\the\usersanitizer % if not recognised, skip it
-    \fi\fi
+    \else\the\usersanitizer
+    \iftokprocessed\else\makeolproctokctl
+    \iftokprocessed\else\makeolproctokmath % if not recognised, skip it
+    \fi\fi\fi\fi
    \else  % we don't have a control sequence, it's an ordinary char
     \ifx/\nxt \addF{\string\/}% quote chars special to PDF with backslash
     \else\ifx(\nxt \addF{\string\(}\else\ifx)\nxt \addF{\string\)}%
@@ -170,6 +172,34 @@
    \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi%\fi\fi
   \next
 }
+\def\makeolproctokctl{%
+  \ifx\nxt\PASCAL\addF{Pascal\space}\let\next\makeolgobbletok % \PASCAL/
+  \else\ifx\nxt\UNIX\addF{UNIX}\let\next\makeolgobbletok % \UNIX/
+  \else\ifx\nxt\TEX\addF{TeX}\let\next\makeolgobbletok % \TEX/
+  \else\ifx\nxt\TeX\addF{TeX}\else\ifx\nxt\LaTeX\addF{LaTeX}%
+  \else\ifx\nxt\CPLUSPLUS\addF{C++}\let\next\makeolgobbletok % \CPLUSPLUS/
+  \else\ifx\nxt\CEE\addF{C}\else\ifx\nxt\Cee\addF{C}%
+  \else\ifx\nxt\PB \let\next\makeolgobbletok \tokprocessedtrue % \PB{...}
+  \else\ifx\nxt\.\tokprocessedtrue\instrtrue % \.{...}
+      % skip \|
+  \else\ifx\nxt\\\ifinstr\addF{\bschar\bschar}\else\tokprocessedtrue\fi
+  \else\ifx\nxt\&\ifinstr\addF&\else\tokprocessedtrue\fi
+  \else\ifx\nxt\~\ifTnum\addF{0}\else\addF\tildechar\fi % 077->\T{\~77}
+  \else\ifx\nxt\_\ifTnum\addF{E}\else\addF_\fi  % 0.1E5->\T{0.1\_5}
+  \else\ifx\nxt\^\ifTnum\addF{0x}\else\addF^\fi  % 0x77 -> \T{\^77}
+  \else\ifx\nxt\$\ifTnum\tokprocessedtrue\else\addF$\fi % \T{77\$L} %$%
+  \else\ifx\nxt\{\addF\lbchar       \else\ifx\nxt\}\addF\rbchar
+  \else\ifx\nxt\ \addF\space        \else\ifx\nxt\#\addF{\string\#}%
+  \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
+}
+\def\makeolproctokmath{%
+  \ifx\nxt\alpha\addF{alpha}\else\ifx\nxt\beta\addF{beta}%
+  \else\ifx\nxt\gamma\addF{gamma}\else\ifx\nxt\delta\addF{delta}%
+  \else\ifx\nxt\theta\addF{theta}\else\ifx\nxt\psqrt\addF{root }%
+  \else\ifx\nxt\H\addF{"}\else\ifx\nxt\O\addF{'}%
+  \else\ifx\nxt\v\addF{|}\else\ifx\nxt\S\addF{==}%
+  \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
+}
 \def\makeolproctokchar#1 #2 #3{\addF{#3}}
 \def\outlinedone{\edef\outlinest{\global\noexpand\toksE={\the\toksF}}%
   \outlinest\let\outlinedone=\relax}
@@ -184,7 +214,7 @@
     \else \special{pdf: dest (\romannumeral\modstar)
       [ @thispage /FitH @ypos ]}\fi}}\fi}
 \let\startsection=\stsec
-\def\defin#1{\global\advance\ind by 2 \1\&{#1 } } % begin `define' or `format'
+\def\defin#1{\global\advance\ind by 2 \1\&{#1 }} % begin `define' or `format'
 \def\A{\note{See also section}} % xref for doubly defined section name
 \def\As{\note{See also sections}} % xref for multiply defined section name
 \def\B{\mathopen{\.{@\{}}} % begin controlled comment
@@ -207,8 +237,10 @@
   \ifacro{\toksF={}\makeoutlinetoks#2\outlinedone\outlinedone}\fi
   \gtitle={#2}\MN#1.\vfil\eject % define running headline
   \message{*\modno} % progress report
+  \def\stripprefix##1>{}\def\gtitletoks{#2}%
+  \edef\gtitletoks{\expandafter\stripprefix\meaning\gtitletoks}%
   \edef\next{\write\cont{\Z{#2}{\modno}% write to contents file
-   {\noexpand\the\pageno}}}\next % \Z{title}{sec}{page}
+   {\noexpand\the\pageno}{\the\toksE}}}\next % \Z{title}{sec}{page}{ss}
   \ifpdf\special{pdf: outline 0 << /Title (\the\toksE) /Dest
     [ @thispage /FitH @ypos ] >>}\fi
   \ifon\startsection{\bf#2.\quad}\ignorespaces}
@@ -361,9 +393,9 @@
   \else \csname#1\endcsname \fi} % Petr Olsak's macros from texinfo.tex
 \def\advancenumber#1{\countA=\expnumber{#1}\relax \advance\countA by1
   \expandafter\xdef\csname#1\endcsname{\the\countA}}
-\def\writebookmarkline#1#2#3{{%
+\def\writebookmarkline#1#2#3#4{{%
   \let\(=\let \let\)=\let \let\[=\let \let\]=\let \let\/=\let
-  \pdfoutline goto num #2{#1}}}
+  \pdfoutline goto num #2{#4}}}
 \def\con{\par\vfill\eject % finish the section names
 % \ifodd\pageno\else\titletrue\null\vfill\eject\fi % for duplex printers
   \rightskip 0pt \hyphenpenalty 50 \tolerance 200
@@ -377,7 +409,7 @@
   \let\Z=\contentsline
   \readcontents\relax % read the contents info
   \botofcontents \end} % print the contents page(s) and terminate
-\def\contentsline#1#2#3{%
+\def\contentsline#1#2#3#4{%
     \line{\ignorespaces#1
       \rm\leaders\hbox to .5em{.\hfil}\hfil
       \ \ifacro\pdflink{#2}{\romannumeral#2}\else#2\fi\hbox to3em{\hss#3}}}
-- 
cgit v1.2.3

