[latex3-commits] [git/LaTeX3-latex3-latex3] master: Avoid loop with encoding commands in \text_purify:n (f60d96c9d)
Joseph Wright
joseph.wright at morningstar2.co.uk
Tue Jan 5 22:50:50 CET 2021
Repository : https://github.com/latex3/latex3
On branch : master
Link : https://github.com/latex3/latex3/commit/f60d96c9d907c388d9fd2f77d696ef5c6ddd8e9f
>---------------------------------------------------------------
commit f60d96c9d907c388d9fd2f77d696ef5c6ddd8e9f
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Tue Jan 5 21:50:50 2021 +0000
Avoid loop with encoding commands in \text_purify:n
>---------------------------------------------------------------
f60d96c9d907c388d9fd2f77d696ef5c6ddd8e9f
l3kernel/CHANGELOG.md | 3 +++
l3kernel/l3text-purify.dtx | 24 +++++++++++++++++++++---
2 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/l3kernel/CHANGELOG.md b/l3kernel/CHANGELOG.md
index 99b085f79..3f99c660b 100644
--- a/l3kernel/CHANGELOG.md
+++ b/l3kernel/CHANGELOG.md
@@ -7,6 +7,9 @@ this project uses date-based 'snapshot' version identifiers.
## [Unreleased]
+### Fixed
+- Handling of encoding-specfic commands in `\text_purify:n`
+
## [2021-01-01]
## [2020-12-19]
diff --git a/l3kernel/l3text-purify.dtx b/l3kernel/l3text-purify.dtx
index 2b2c5d132..de64513ba 100644
--- a/l3kernel/l3text-purify.dtx
+++ b/l3kernel/l3text-purify.dtx
@@ -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
+ }
+% \begin{macrocode}
+% Handle encoding commands, as detailed for expansion.
+% \end{macrocode}
+\cs_new:Npn \@@_purify_encoding:N #1
+ {
+ \bool_lazy_or:nnTF
+ { \cs_if_eq_p:NN #1 \@current at cmd }
+ { \cs_if_eq_p:NN #1 \@changed at 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}
% {
More information about the latex3-commits
mailing list.