summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/l3kernel/l3text-case.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/l3kernel/l3text-case.dtx')
-rw-r--r--macros/latex/contrib/l3kernel/l3text-case.dtx81
1 files changed, 79 insertions, 2 deletions
diff --git a/macros/latex/contrib/l3kernel/l3text-case.dtx b/macros/latex/contrib/l3kernel/l3text-case.dtx
index 0f6a78cbe6..6cb58cb567 100644
--- a/macros/latex/contrib/l3kernel/l3text-case.dtx
+++ b/macros/latex/contrib/l3kernel/l3text-case.dtx
@@ -43,7 +43,7 @@
% }^^A
% }
%
-% \date{Released 2022-07-01}
+% \date{Released 2022-07-04}
%
% \maketitle
%
@@ -151,6 +151,15 @@
% \begin{macro}[EXP]{\@@_change_case_exclude:nnNN}
% \begin{macro}[EXP]{\@@_change_case_exclude:nnNw}
% \begin{macro}[EXP]{\@@_change_case_exclude:nnNnn}
+% \begin{macro}[EXP]{\@@_change_case_replace:nnN}
+% \begin{macro}[EXP]{\@@_change_case_replace:nnn}
+% \begin{macro}[EXP]{\@@_change_case_switch:nnN}
+% \begin{macro}[EXP]
+% {
+% \@@_change_case_switch_lower:nnNnnnn ,
+% \@@_change_case_switch_upper:nnNnnnn ,
+% \@@_change_case_switch_title:nnNnnnn
+% }
% \begin{macro}[EXP]
% {
% \@@_change_case_letterlike_lower:nnN ,
@@ -446,7 +455,7 @@
\cs_new:Npn \@@_change_case_exclude:nnNN #1#2#3#4
{
\@@_if_recursion_tail_stop_do:Nn #4
- { \use:c { @@_change_case_letterlike_ #1 :nnN } {#1} {#2} #3 }
+ { \@@_change_case_replace:nnN {#1} {#2} #3 }
\str_if_eq:nnTF {#3} {#4}
{
\@@_use_i_delimit_by_q_recursion_stop:nw
@@ -471,6 +480,45 @@
\@@_change_case_loop:nnw {#1} {#2}
}
% \end{macrocode}
+% Deal with any specialist replacement for case changing.
+% \begin{macrocode}
+\cs_new:Npn \@@_change_case_replace:nnN #1#2#3
+ {
+ \cs_if_exist:cTF { l_@@_case_ \token_to_str:N #3 _tl }
+ {
+ \exp_args:Nv \@@_change_case_replace:nnn
+ { l_@@_case_ \token_to_str:N #3 _tl } {#1} {#2}
+ }
+ { \@@_change_case_switch:nnN {#1} {#2} #3 }
+ }
+\cs_new:Npn \@@_change_case_replace:nnn #1#2#3
+ { \@@_change_case_loop:nnw {#2} {#3} #1 }
+% \end{macrocode}
+% Allow for manually-controlled case switching.
+% \begin{macrocode}
+\cs_new:Npn \@@_change_case_switch:nnN #1#2#3
+ {
+ \cs_if_eq:NNTF #3 \text_case_switch:nnnn
+ { \use:c { @@_change_case_switch_ #1 :nnNnnnn } }
+ { \use:c { @@_change_case_letterlike_ #1 :nnN } }
+ {#1} {#2} #3
+ }
+\cs_new:Npn \@@_change_case_switch_lower:nnNnnnn #1#2#3#4#5#6#7
+ {
+ \@@_change_case_store:n {#5}
+ \@@_change_case_loop:nnw {#1} {#2}
+ }
+\cs_new:Npn \@@_change_case_switch_upper:nnNnnnn #1#2#3#4#5#6#7
+ {
+ \@@_change_case_store:n {#6}
+ \@@_change_case_loop:nnw {#1} {#2}
+ }
+\cs_new:Npn \@@_change_case_switch_title:nnNnnnn #1#2#3#4#5#6#7
+ {
+ \@@_change_case_store:n {#7}
+ \@@_change_case_loop:nnw {#1} {#2}
+ }
+% \end{macrocode}
% Letter-like commands may still be present: they are set up using a simple
% lookup approach, so can easily be handled with no loop. If there is no
% hit, we are at the end of the process: we loop around. Letter-like chars
@@ -771,6 +819,35 @@
% \end{macro}
% \end{macro}
% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\text_declare_case_equivalent:Nn}
+% Create equivalents to allow replacement.
+% \begin{macrocode}
+\cs_new_protected:Npn \text_declare_case_equivalent:Nn #1#2
+ {
+ \tl_clear_new:c { l_@@_case_ \token_to_str:N #1 _tl }
+ \tl_set:cn { l_@@_case_ \token_to_str:N #1 _tl } {#2}
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\text_case_switch:nnnn}
+% \begin{macro}{\@@_case_switch_marker:}
+% Set up the mechanism for manual case switching.
+% \begin{macrocode}
+\cs_new:Npn \text_case_switch:nnnn #1#2#3#4
+ {
+ \@@_case_switch_marker:
+ #1
+ }
+\cs_new:Npn \@@_case_switch_marker: { }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
%
% \begin{macro}[EXP]{\@@_change_case_upper_de-x-eszett:nnnN, \@@_change_case_upper_de-alt:nnnN}
% \begin{macro}[EXP]{\@@_change_case_upper_de-x-eszett:nnnNN}