[latex3-commits] [git/LaTeX3-latex3-latex3] master: More efficient handling of encodings (see #671) (3c84ec0e9)

Joseph Wright joseph.wright at morningstar2.co.uk
Mon Feb 10 19:41:09 CET 2020


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/3c84ec0e9be4f1ddceaab5385b32a98c43e20b71

>---------------------------------------------------------------

commit 3c84ec0e9be4f1ddceaab5385b32a98c43e20b71
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Mon Feb 10 18:41:09 2020 +0000

    More efficient handling of encodings (see #671)


>---------------------------------------------------------------

3c84ec0e9be4f1ddceaab5385b32a98c43e20b71
 l3kernel/l3text.dtx | 58 +++++++++++++----------------------------------------
 1 file changed, 14 insertions(+), 44 deletions(-)

diff --git a/l3kernel/l3text.dtx b/l3kernel/l3text.dtx
index 20b6b6763..9878b1fc9 100644
--- a/l3kernel/l3text.dtx
+++ b/l3kernel/l3text.dtx
@@ -529,7 +529,8 @@
 % \begin{macro}[EXP]{\@@_expand_letterlike:N}
 % \begin{macro}[EXP]{\@@_expand_letterlike:NN}
 % \begin{macro}[EXP]{\@@_expand_cs:N, \@@_expand_encoding:N}
-% \begin{macro}[EXP]{\@@_expand_encoding:NNnnnn}
+% \begin{macro}[EXP]{\@@_expand_encoding_escape:N}
+% \begin{macro}[EXP]{\@@_expand_encoding_escape:Nn}
 % \begin{macro}[EXP]{\@@_expand_protect:N}
 % \begin{macro}[EXP]{\@@_expand_protect:nN}
 % \begin{macro}[EXP]{\@@_expand_protect:Nw}
@@ -849,9 +850,9 @@
     \exp_not:N \str_if_eq:nnTF {#1} { \exp_not:N \protect }
       { \exp_not:N \@@_expand_protect:N }
       {
-        \cs_if_exist:NTF \cdp at list
+        \cs_if_exist:cTF { @current at cmd }
           { \exp_not:N \@@_expand_encoding:N #1 }
-          { \exp_not:N \@@_expand_expand:N #1 }
+          { \exp_not:N \@@_expand_replace:N #1 }
       }
   }
 \cs_new:Npn \@@_expand_protect:N #1
@@ -873,42 +874,20 @@
     \@@_expand_loop:w
   }
 %    \end{macrocode}
-%   Deal with encoding-specific commands in package mode: at the end of
-%   the preamble, we tidy up as the data otherwise vanishes.
+%   Deal with encoding-specific commands
 %    \begin{macrocode}
-\cs_if_exist:NT \cdp at list
+\cs_new:Npn \@@_expand_encoding:N #1
   {
-    \cs_new:Npn \@@_expand_encoding:N #1
+    \cs_if_eq:NNTF #1 \@current at cmd
+      { \@@_expand_loop:w \@@_expand_encoding_escape:N }
       {
-        \exp_after:wN \@@_expand_encoding:NNnnnn \exp_after:wN #1
-          \cdp at list \q_recursion_tail { } { } { } { } \q_recursion_stop
-      }
-    \cs_new:Npn \@@_expand_encoding:NNnnnn #1#2#3#4#5#6
-      {
-        \quark_if_recursion_tail_stop_do:Nn #2 { \@@_expand_replace:N #1 }
-        \str_if_eq:eeTF { \exp_not:N #1 } { \exp_not:c { #3 - cmd } }
-          {
-            \use_i_delimit_by_q_recursion_stop:nw
-              { \@@_expand_loop:w \@@_expand_textcomp:NN #1 }
-          }
-          { \@@_expand_encoding:NNnnnn #1 }
-      }
-    \AtBeginDocument
-      {
-        \cs_set:Npn \@@_expand_cs:N #1
-          {
-            \str_if_eq:nnTF {#1} { \protect }
-              { \@@_expand_protect:N }
-              { \@@_expand_replace:N #1 }
-          }
-        \cs_set_protected:Npn \cdp at elt #1#2#3#4
-          {
-            \text_declare_expand_equivalent:cn { #1 -cmd }
-              { \@@_expand_textcomp:NN }
-          }
-        \cdp at list
+        \cs_if_eq:NNTF #1 \@changed at cmd
+          { \@@_expand_loop:w \@@_expand_encoding_escape:Nn }
+          { \@@_expand_replace:N #1 }
       }
   }
+\cs_new:Npn \@@_expand_encoding_escape:N #1 { \exp_not: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}
@@ -984,6 +963,7 @@
 % \end{macro}
 % \end{macro}
 % \end{macro}
+% \end{macro}
 %
 % \begin{macro}
 %   {
@@ -1001,16 +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 }
-%</package>
-%    \end{macrocode}
-% \end{macro}
-%
 %    \begin{macrocode}
 %</initex|package>
 %    \end{macrocode}





More information about the latex3-commits mailing list.