diff options
Diffstat (limited to 'macros/latex/contrib/l3kernel/l3text.dtx')
-rw-r--r-- | macros/latex/contrib/l3kernel/l3text.dtx | 60 |
1 files changed, 34 insertions, 26 deletions
diff --git a/macros/latex/contrib/l3kernel/l3text.dtx b/macros/latex/contrib/l3kernel/l3text.dtx index 72f91af2f1..8940ce5af0 100644 --- a/macros/latex/contrib/l3kernel/l3text.dtx +++ b/macros/latex/contrib/l3kernel/l3text.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2020-02-08} +% \date{Released 2020-02-11} % % \maketitle % @@ -74,7 +74,7 @@ % including implicit groups, are converted to their explicit equivalent. % Any commands listed in \cs{l_text_expand_exclude_tl}, % \cs{l_text_accents_tl} and \cs{l_text_letterlike_tl} are excluded from -% expansion +% expansion. % \end{function} % % \begin{function}[added = 2020-01-22] @@ -464,7 +464,7 @@ \tl_new:N \l_text_expand_exclude_tl %<*package> \tl_set:Nn \l_text_expand_exclude_tl - { \cite \label \ref } + { \begin \cite \end \label \ref } %</package> % \end{macrocode} % \end{variable} @@ -528,11 +528,9 @@ % \begin{macro}[EXP]{\@@_expand_exclude:Nn} % \begin{macro}[EXP]{\@@_expand_letterlike:N} % \begin{macro}[EXP]{\@@_expand_letterlike:NN} -% \begin{macro}[EXP] -% { -% \@@_expand_cs:N , -% \@@_expand_protect:N -% } +% \begin{macro}[EXP]{\@@_expand_cs:N, \@@_expand_encoding:N} +% \begin{macro}[EXP]{\@@_expand_encoding_escape:N} +% \begin{macro}[EXP]{\@@_expand_protect:N} % \begin{macro}[EXP]{\@@_expand_protect:nN} % \begin{macro}[EXP]{\@@_expand_protect:Nw} % \begin{macro}[EXP]{\@@_expand_replace:N} @@ -846,11 +844,15 @@ % the \cs{protect} might be explicit, in which case we need to leave it alone % if it's required. % \begin{macrocode} -\cs_new:Npn \@@_expand_cs:N #1 +\cs_new:Npx \@@_expand_cs:N #1 { - \str_if_eq:nnTF {#1} { \protect } - { \@@_expand_protect:N } - { \@@_expand_replace:N #1 } + \exp_not:N \str_if_eq:nnTF {#1} { \exp_not:N \protect } + { \exp_not:N \@@_expand_protect:N } + { + \cs_if_exist:cTF { @current@cmd } + { \exp_not:N \@@_expand_encoding:N #1 } + { \exp_not:N \@@_expand_replace:N #1 } + } } \cs_new:Npn \@@_expand_protect:N #1 { @@ -871,6 +873,23 @@ \@@_expand_loop:w } % \end{macrocode} +% Deal with encoding-specific commands +% \begin{macrocode} +\cs_new:Npn \@@_expand_encoding:N #1 + { + \cs_if_eq:NNTF #1 \@current@cmd + { \exp_after:wN \@@_expand_loop:w \@@_expand_encoding_escape:NN } + { + \cs_if_eq:NNTF #1 \@changed@cmd + { + \exp_after:wN \@@_expand_loop:w + \@@_expand_encoding_escape:NN + } + { \@@_expand_replace:N #1 } + } + } +\cs_new:Npn \@@_expand_encoding_escape:NN #1#2 { \exp_not:n {#1} } +% \end{macrocode} % See if there is a dedicated replacement, and if there is, insert it. % \begin{macrocode} \cs_new:Npn \@@_expand_replace:N #1 @@ -943,13 +962,15 @@ % \end{macro} % \end{macro} % \end{macro} +% \end{macro} +% \end{macro} % % \begin{macro} % { % \text_declare_expand_equivalent:Nn , % \text_declare_expand_equivalent:cn % } -% Create equivalents to allow replacement. +% Create equivalents to allow replacement. % \begin{macrocode} \cs_new_protected:Npn \text_declare_expand_equivalent:Nn #1#2 { @@ -960,19 +981,6 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[EXP]{\@@_expand_textcomp:NN} -% Filter out \pkg{textcomp}-like commands. -% \begin{macrocode} -%<*package> -\cs_new:Npn \@@_expand_textcomp:NN #1#2 { \exp_not:n {#1} } -\text_declare_expand_equivalent:cn { ?-cmd } { \@@_expand_textcomp:NN } -\text_declare_expand_equivalent:cn { T1-cmd } { \@@_expand_textcomp:NN } -\text_declare_expand_equivalent:cn { TS1-cmd } { \@@_expand_textcomp:NN } -\text_declare_expand_equivalent:cn { TU-cmd } { \@@_expand_textcomp:NN } -%</package> -% \end{macrocode} -% \end{macro} -% % \begin{macrocode} %</initex|package> % \end{macrocode} |