diff options
Diffstat (limited to 'macros/latex/contrib/l3kernel/l3text-purify.dtx')
-rw-r--r-- | macros/latex/contrib/l3kernel/l3text-purify.dtx | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/macros/latex/contrib/l3kernel/l3text-purify.dtx b/macros/latex/contrib/l3kernel/l3text-purify.dtx index 0166cc20f6..0241a11e60 100644 --- a/macros/latex/contrib/l3kernel/l3text-purify.dtx +++ b/macros/latex/contrib/l3kernel/l3text-purify.dtx @@ -2,7 +2,7 @@ % %% File: l3text-purify.dtx % -% Copyright (C) 2020 The LaTeX3 Project +% Copyright (C) 2020,2021 The LaTeX3 Project % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2020-12-07} +% \date{Released 2021-01-09} % % \maketitle % @@ -94,7 +94,8 @@ % \begin{macro}[EXP]{\@@_purify_math_cmd:Nn} % \begin{macro}[EXP]{\@@_purify_replace:N} % \begin{macro}[EXP]{\@@_purify_replace:n} -% \begin{macro}[EXP]{\@@_purify_expand:N, \@@_purify_protect:N} +% \begin{macro}[EXP]{\@@_purify_expand:N, \@@_purify_protect:N, \@@_purify_encoding:N} +% \begin{macro}[EXP]{\@@_purify_encoding_escape:NN} % As in the other parts of the module, we start off with a standard % \enquote{action} loop, with expansion applied up-front. % \begin{macrocode} @@ -288,15 +289,31 @@ { \str_if_eq:nnTF {#1} { \protect } { \@@_purify_protect:N } + { \@@_purify_encoding:N #1 } + } +\cs_new:Npn \@@_purify_protect:N #1 + { + \@@_if_recursion_tail_stop_do:Nn #1 { \@@_purify_end:w } + \@@_purify_loop:w + } +% \end{macrocode} +% Handle encoding commands, as detailed for expansion. +% \begin{macrocode} +\cs_new:Npn \@@_purify_encoding:N #1 + { + \bool_lazy_or:nnTF + { \cs_if_eq_p:NN #1 \@current@cmd } + { \cs_if_eq_p:NN #1 \@changed@cmd } + { \@@_purify_encoding_escape:NN } { \@@_if_expandable:NTF #1 { \exp_after:wN \@@_purify_loop:w #1 } { \@@_purify_loop:w } } } -\cs_new:Npn \@@_purify_protect:N #1 +\cs_new:Npn \@@_purify_encoding_escape:NN #1#2 { - \@@_if_recursion_tail_stop_do:Nn #1 { \@@_purify_end:w } + \@@_purify_store:n {#1} \@@_purify_loop:w } % \end{macrocode} @@ -323,6 +340,7 @@ % \end{macro} % \end{macro} % \end{macro} +% \end{macro} % % \begin{macro} % { |