summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/l3kernel/l3text.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/l3kernel/l3text.dtx')
-rw-r--r--macros/latex/contrib/l3kernel/l3text.dtx81
1 files changed, 58 insertions, 23 deletions
diff --git a/macros/latex/contrib/l3kernel/l3text.dtx b/macros/latex/contrib/l3kernel/l3text.dtx
index 7615cf3969..67218edf30 100644
--- a/macros/latex/contrib/l3kernel/l3text.dtx
+++ b/macros/latex/contrib/l3kernel/l3text.dtx
@@ -43,7 +43,7 @@
% }^^A
% }
%
-% \date{Released 2022-07-15}
+% \date{Released 2022-08-05}
%
% \maketitle
%
@@ -170,11 +170,12 @@
% Unicode \TeX{} engines.
% \item Greek (\texttt{el}).
% Removes accents from Greek letters when uppercasing; titlecasing
-% leaves accents in place. (At present this is implemented only
-% for Unicode engines.) A variant \texttt{el-x-iota} is available
+% leaves accents in place. A variant \texttt{el-x-iota} is available
% which retains the \textit{ypogegrammeni} (subscript muted iota)
% when uppercasing: the standard version converts these to a following
-% capital iota.
+% capital iota. For $8$-bit engines a simplified approach is taken
+% which will remove accents when uppercasing but without full
+% context analysis.
% \item Lithuanian (\texttt{lt}).
% The lowercase letters i and j should retain a dot above when the
% accents grave, acute or tilde are present. This is implemented for
@@ -355,10 +356,42 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[EXP]{\@@_if_recursion_tail_stop_do:Nn}
+% \begin{macro}[EXP]{\@@_if_q_recursion_tail_stop_do:Nn}
% Functions to query recursion quarks.
% \begin{macrocode}
-\__kernel_quark_new_test:N \@@_if_recursion_tail_stop_do:Nn
+\__kernel_quark_new_test:N \@@_if_q_recursion_tail_stop_do:Nn
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{variable}{\s_@@_recursion_tail,\s_@@_recursion_stop}
+% Internal scan marks quarks.
+% \begin{macrocode}
+\scan_new:N \s_@@_recursion_tail
+\scan_new:N \s_@@_recursion_stop
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{macro}[EXP]{\@@_use_i_delimit_by_s_recursion_stop:nw}
+% Functions to gobble up to a scan mark.
+% \begin{macrocode}
+\cs_new:Npn \@@_use_i_delimit_by_s_recursion_stop:nw
+ #1 #2 \s_@@_recursion_stop {#1}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[EXP]{\@@_if_s_recursion_tail_stop_do:Nn}
+% Functions to query recursion scan marks. Slower than a quark
+% test but needed to avoid issues in the outer expansion loop
+% with unterminated \tn{romannumeral} primitives.
+% \begin{macrocode}
+\cs_new:Npn \@@_if_s_recursion_tail_stop_do:Nn #1
+ {
+ \bool_lazy_and:nnTF
+ { \cs_if_eq_p:NN \s_@@_recursion_tail #1 }
+ { \str_if_eq_p:nn { \s_@@_recursion_tail } {#1} }
+ { \@@_use_i_delimit_by_s_recursion_stop:nw }
+ { \use_none:n }
+ }
% \end{macrocode}
% \end{macro}
%
@@ -731,7 +764,9 @@
% arbitrary user commands which might be protected \emph{and} take
% arguments, and if the expansion code is used in a typesetting
% context, that will otherwise explode. (The same issue applies more
-% clearly to case changing: see the example there.)
+% clearly to case changing: see the example there.) The outer
+% loop has to use scan marks as delimiters to protect against
+% unterminated \tn{romannumeral} usage in the input.
% \begin{macrocode}
\cs_new:Npn \text_expand:n #1
{
@@ -745,7 +780,7 @@
{
\group_align_safe_begin:
\@@_expand_loop:w #1
- \q_@@_recursion_tail \q_@@_recursion_stop
+ \s_@@_recursion_tail \s_@@_recursion_stop
\@@_expand_result:n { }
}
% \end{macrocode}
@@ -768,7 +803,7 @@
% recursively, while spaces are just passed through. Thus all of the
% action is in handling \texttt{N}-type tokens.
% \begin{macrocode}
-\cs_new:Npn \@@_expand_loop:w #1 \q_@@_recursion_stop
+\cs_new:Npn \@@_expand_loop:w #1 \s_@@_recursion_stop
{
\tl_if_head_is_N_type:nTF {#1}
{ \@@_expand_N_type:N }
@@ -777,7 +812,7 @@
{ \@@_expand_group:n }
{ \@@_expand_space:w }
}
- #1 \q_@@_recursion_stop
+ #1 \s_@@_recursion_stop
}
\cs_new:Npn \@@_expand_group:n #1
{
@@ -805,7 +840,7 @@
% \begin{macrocode}
\cs_new:Npx \@@_expand_N_type:N #1
{
- \exp_not:N \@@_if_recursion_tail_stop_do:Nn #1
+ \exp_not:N \@@_if_s_recursion_tail_stop_do:Nn #1
{ \exp_not:N \@@_expand_end:w }
\exp_not:N \bool_lazy_any:nTF
{
@@ -884,7 +919,7 @@
}
\cs_new:Npn \@@_expand_math_search:NNN #1#2#3
{
- \@@_if_recursion_tail_stop_do:Nn #2
+ \@@_if_q_recursion_tail_stop_do:Nn #2
{ \@@_expand_explicit:N #1 }
\token_if_eq_meaning:NNTF #1 #2
{
@@ -896,7 +931,7 @@
}
{ \@@_expand_math_search:NNN #1 }
}
-\cs_new:Npn \@@_expand_math_loop:Nw #1#2 \q_@@_recursion_stop
+\cs_new:Npn \@@_expand_math_loop:Nw #1#2 \s_@@_recursion_stop
{
\tl_if_head_is_N_type:nTF {#2}
{ \@@_expand_math_N_type:NN }
@@ -905,11 +940,11 @@
{ \@@_expand_math_group:Nn }
{ \@@_expand_math_space:Nw }
}
- #1#2 \q_@@_recursion_stop
+ #1#2 \s_@@_recursion_stop
}
\cs_new:Npn \@@_expand_math_N_type:NN #1#2
{
- \@@_if_recursion_tail_stop_do:Nn #2
+ \@@_if_s_recursion_tail_stop_do:Nn #2
{ \@@_expand_end:w }
\@@_expand_store:n {#2}
\token_if_eq_meaning:NNTF #2 #1
@@ -989,7 +1024,7 @@
}
\cs_new:Npn \@@_expand_exclude:NN #1#2
{
- \@@_if_recursion_tail_stop_do:Nn #2
+ \@@_if_q_recursion_tail_stop_do:Nn #2
{ \@@_expand_accent:N #1 }
\str_if_eq:nnTF {#1} {#2}
{
@@ -1016,7 +1051,7 @@
}
\cs_new:Npn \@@_expand_accent:NN #1#2
{
- \@@_if_recursion_tail_stop_do:Nn #2
+ \@@_if_q_recursion_tail_stop_do:Nn #2
{ \@@_expand_letterlike:N #1 }
\cs_if_eq:NNTF #2 #1
{
@@ -1040,7 +1075,7 @@
}
\cs_new:Npn \@@_expand_letterlike:NN #1#2
{
- \@@_if_recursion_tail_stop_do:Nn #2
+ \@@_if_q_recursion_tail_stop_do:Nn #2
{ \@@_expand_cs:N #1 }
\cs_if_eq:NNTF #2 #1
{
@@ -1072,7 +1107,7 @@
{ \exp_not:N \@@_expand_replace:N #1 }
}
}
-\cs_new:Npn \@@_expand_protect:w #1 \q_@@_recursion_stop
+\cs_new:Npn \@@_expand_protect:w #1 \s_@@_recursion_stop
{
\tl_if_head_is_N_type:nTF {#1}
{ \@@_expand_protect:N }
@@ -1080,11 +1115,11 @@
\@@_expand_store:n { \protect }
\@@_expand_loop:w
}
- #1 \q_@@_recursion_stop
+ #1 \s_@@_recursion_stop
}
\cs_new:Npn \@@_expand_protect:N #1
{
- \@@_if_recursion_tail_stop_do:Nn #1
+ \@@_if_s_recursion_tail_stop_do:Nn #1
{
\@@_expand_store:n { \protect }
\@@_expand_end:w
@@ -1186,7 +1221,7 @@
\exp_after:wN \@@_expand_unexpanded_test:w
\exp:w \exp_end_continue_f:w
}
-\cs_new:Npn \@@_expand_unexpanded_test:w #1 \q_@@_recursion_stop
+\cs_new:Npn \@@_expand_unexpanded_test:w #1 \s_@@_recursion_stop
{
\tl_if_head_is_group:nTF {#1}
{ \@@_expand_unexpanded:n }
@@ -1194,7 +1229,7 @@
\@@_expand_unexpanded:w
\tl_if_head_is_N_type:nT {#1} { \@@_expand_unexpanded:N }
}
- #1 \q_@@_recursion_stop
+ #1 \s_@@_recursion_stop
}
\cs_new:Npn \@@_expand_unexpanded:N #1
{