[latex3-commits] [l3svn] r6650 - Special-case \protect in case-changing code

noreply at latex-project.org noreply at latex-project.org
Sun Aug 14 14:17:20 CEST 2016


Author: bruno
Date: 2016-08-14 14:17:20 +0200 (Sun, 14 Aug 2016)
New Revision: 6650

Modified:
   trunk/l3kernel/l3candidates.dtx
   trunk/l3kernel/testfiles/m3expl001.luatex.tlg
   trunk/l3kernel/testfiles/m3expl001.ptex.tlg
   trunk/l3kernel/testfiles/m3expl001.tlg
   trunk/l3kernel/testfiles/m3expl001.uptex.tlg
   trunk/l3kernel/testfiles/m3expl001.xetex.tlg
   trunk/l3kernel/testfiles/m3expl003.luatex.tlg
   trunk/l3kernel/testfiles/m3expl003.ptex.tlg
   trunk/l3kernel/testfiles/m3expl003.tlg
   trunk/l3kernel/testfiles/m3expl003.uptex.tlg
   trunk/l3kernel/testfiles/m3expl003.xetex.tlg
   trunk/l3kernel/testfiles/m3tl013.luatex.tlg
   trunk/l3kernel/testfiles/m3tl013.lvt
   trunk/l3kernel/testfiles/m3tl013.tlg
   trunk/l3kernel/testfiles/m3tl013.uptex.tlg
   trunk/l3kernel/testfiles/m3tl013.xetex.tlg
Log:
Special-case \protect in case-changing code

In package mode, \protect \foo now prevents the expansion of \foo 
normally done by the case-changing code.



Modified: trunk/l3kernel/l3candidates.dtx
===================================================================
--- trunk/l3kernel/l3candidates.dtx	2016-08-14 11:14:44 UTC (rev 6649)
+++ trunk/l3kernel/l3candidates.dtx	2016-08-14 12:17:20 UTC (rev 6650)
@@ -3018,6 +3018,7 @@
 % \begin{macro}[aux, EXP]{\@@_change_case_cs:N}
 % \begin{macro}[aux, EXP]{\@@_change_case_cs:NN}
 % \begin{macro}[aux, EXP]{\@@_change_case_cs:NNn}
+% \begin{macro}[aux, EXP]{\@@_change_case_protect:wNN}
 % \begin{macro}[aux, EXP]{\@@_change_case_if_expandable:NTF}
 % \begin{macro}[aux, EXP]{\@@_change_case_cs_expand:Nnw}
 % \begin{macro}[aux, EXP]{\@@_change_case_cs_expand:NN}
@@ -3339,10 +3340,15 @@
 %   on the list which indicate that case changing should be skipped. That's
 %   done using a loop as for the other special cases. If a hit is found then
 %   the argument is grabbed: that comes \emph{after} the loop function which
-%   is therefore rearranged.
+%   is therefore rearranged.  In a \LaTeXe{} context, \tn{protect} needs
+%   to be treated specially, to prevent expansion of the next token but
+%   output it without braces.
 %    \begin{macrocode}
 \cs_new:Npn \@@_change_case_cs:N #1
   {
+%<*package>
+    \str_if_eq:nnTF {#1} { \protect } { \@@_change_case_protect:wNN }
+%</package>
     \exp_after:wN \@@_change_case_cs:NN
       \exp_after:wN #1 \l_tl_case_change_exclude_tl
       \q_recursion_tail \q_recursion_stop
@@ -3366,6 +3372,10 @@
     \@@_change_case_output:nwn { #1 {#3} }
     #2
   }
+%<*package>
+\cs_new:Npn \@@_change_case_protect:wNN #1 \q_recursion_stop #2 #3
+  { \@@_change_case_output:nwn { \protect #3 } #2 }
+%</package>
 %    \end{macrocode}
 %   When a control sequence is not on the exclude list the other test if
 %   to see if it is expandable. Once again, if there is a hit then the loop
@@ -3430,6 +3440,7 @@
 % \end{macro}
 % \end{macro}
 % \end{macro}
+% \end{macro}
 %
 % \begin{macro}[aux, EXP]{\@@_change_case_lower_sigma:Nnw}
 % \begin{macro}[aux, EXP]{\@@_change_case_lower_sigma:w}

Modified: trunk/l3kernel/testfiles/m3expl001.luatex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.luatex.tlg	2016-08-14 11:14:44 UTC (rev 6649)
+++ trunk/l3kernel/testfiles/m3expl001.luatex.tlg	2016-08-14 12:17:20 UTC (rev 6650)
@@ -4667,6 +4667,7 @@
 Defining \__tl_change_case_cs:N on line ...
 Defining \__tl_change_case_cs:NN on line ...
 Defining \__tl_change_case_cs:NNn on line ...
+Defining \__tl_change_case_protect:wNN on line ...
 Defining \__tl_change_case_if_expandable:NTF on line ...
 Defining \__tl_change_case_cs_expand:Nnw on line ...
 Defining \__tl_change_case_cs_expand:NN on line ...

Modified: trunk/l3kernel/testfiles/m3expl001.ptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.ptex.tlg	2016-08-14 11:14:44 UTC (rev 6649)
+++ trunk/l3kernel/testfiles/m3expl001.ptex.tlg	2016-08-14 12:17:20 UTC (rev 6650)
@@ -4659,6 +4659,7 @@
 Defining \__tl_change_case_cs:N on line ...
 Defining \__tl_change_case_cs:NN on line ...
 Defining \__tl_change_case_cs:NNn on line ...
+Defining \__tl_change_case_protect:wNN on line ...
 Defining \__tl_change_case_if_expandable:NTF on line ...
 Defining \__tl_change_case_cs_expand:Nnw on line ...
 Defining \__tl_change_case_cs_expand:NN on line ...

Modified: trunk/l3kernel/testfiles/m3expl001.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.tlg	2016-08-14 11:14:44 UTC (rev 6649)
+++ trunk/l3kernel/testfiles/m3expl001.tlg	2016-08-14 12:17:20 UTC (rev 6650)
@@ -4659,6 +4659,7 @@
 Defining \__tl_change_case_cs:N on line ...
 Defining \__tl_change_case_cs:NN on line ...
 Defining \__tl_change_case_cs:NNn on line ...
+Defining \__tl_change_case_protect:wNN on line ...
 Defining \__tl_change_case_if_expandable:NTF on line ...
 Defining \__tl_change_case_cs_expand:Nnw on line ...
 Defining \__tl_change_case_cs_expand:NN on line ...

Modified: trunk/l3kernel/testfiles/m3expl001.uptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.uptex.tlg	2016-08-14 11:14:44 UTC (rev 6649)
+++ trunk/l3kernel/testfiles/m3expl001.uptex.tlg	2016-08-14 12:17:20 UTC (rev 6650)
@@ -4659,6 +4659,7 @@
 Defining \__tl_change_case_cs:N on line ...
 Defining \__tl_change_case_cs:NN on line ...
 Defining \__tl_change_case_cs:NNn on line ...
+Defining \__tl_change_case_protect:wNN on line ...
 Defining \__tl_change_case_if_expandable:NTF on line ...
 Defining \__tl_change_case_cs_expand:Nnw on line ...
 Defining \__tl_change_case_cs_expand:NN on line ...

Modified: trunk/l3kernel/testfiles/m3expl001.xetex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.xetex.tlg	2016-08-14 11:14:44 UTC (rev 6649)
+++ trunk/l3kernel/testfiles/m3expl001.xetex.tlg	2016-08-14 12:17:20 UTC (rev 6650)
@@ -4665,6 +4665,7 @@
 Defining \__tl_change_case_cs:N on line ...
 Defining \__tl_change_case_cs:NN on line ...
 Defining \__tl_change_case_cs:NNn on line ...
+Defining \__tl_change_case_protect:wNN on line ...
 Defining \__tl_change_case_if_expandable:NTF on line ...
 Defining \__tl_change_case_cs_expand:Nnw on line ...
 Defining \__tl_change_case_cs_expand:NN on line ...

Modified: trunk/l3kernel/testfiles/m3expl003.luatex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.luatex.tlg	2016-08-14 11:14:44 UTC (rev 6649)
+++ trunk/l3kernel/testfiles/m3expl003.luatex.tlg	2016-08-14 12:17:20 UTC (rev 6650)
@@ -4668,6 +4668,7 @@
 Defining \__tl_change_case_cs:N on line ...
 Defining \__tl_change_case_cs:NN on line ...
 Defining \__tl_change_case_cs:NNn on line ...
+Defining \__tl_change_case_protect:wNN on line ...
 Defining \__tl_change_case_if_expandable:NTF on line ...
 Defining \__tl_change_case_cs_expand:Nnw on line ...
 Defining \__tl_change_case_cs_expand:NN on line ...

Modified: trunk/l3kernel/testfiles/m3expl003.ptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.ptex.tlg	2016-08-14 11:14:44 UTC (rev 6649)
+++ trunk/l3kernel/testfiles/m3expl003.ptex.tlg	2016-08-14 12:17:20 UTC (rev 6650)
@@ -4660,6 +4660,7 @@
 Defining \__tl_change_case_cs:N on line ...
 Defining \__tl_change_case_cs:NN on line ...
 Defining \__tl_change_case_cs:NNn on line ...
+Defining \__tl_change_case_protect:wNN on line ...
 Defining \__tl_change_case_if_expandable:NTF on line ...
 Defining \__tl_change_case_cs_expand:Nnw on line ...
 Defining \__tl_change_case_cs_expand:NN on line ...

Modified: trunk/l3kernel/testfiles/m3expl003.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.tlg	2016-08-14 11:14:44 UTC (rev 6649)
+++ trunk/l3kernel/testfiles/m3expl003.tlg	2016-08-14 12:17:20 UTC (rev 6650)
@@ -4660,6 +4660,7 @@
 Defining \__tl_change_case_cs:N on line ...
 Defining \__tl_change_case_cs:NN on line ...
 Defining \__tl_change_case_cs:NNn on line ...
+Defining \__tl_change_case_protect:wNN on line ...
 Defining \__tl_change_case_if_expandable:NTF on line ...
 Defining \__tl_change_case_cs_expand:Nnw on line ...
 Defining \__tl_change_case_cs_expand:NN on line ...

Modified: trunk/l3kernel/testfiles/m3expl003.uptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.uptex.tlg	2016-08-14 11:14:44 UTC (rev 6649)
+++ trunk/l3kernel/testfiles/m3expl003.uptex.tlg	2016-08-14 12:17:20 UTC (rev 6650)
@@ -4660,6 +4660,7 @@
 Defining \__tl_change_case_cs:N on line ...
 Defining \__tl_change_case_cs:NN on line ...
 Defining \__tl_change_case_cs:NNn on line ...
+Defining \__tl_change_case_protect:wNN on line ...
 Defining \__tl_change_case_if_expandable:NTF on line ...
 Defining \__tl_change_case_cs_expand:Nnw on line ...
 Defining \__tl_change_case_cs_expand:NN on line ...

Modified: trunk/l3kernel/testfiles/m3expl003.xetex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.xetex.tlg	2016-08-14 11:14:44 UTC (rev 6649)
+++ trunk/l3kernel/testfiles/m3expl003.xetex.tlg	2016-08-14 12:17:20 UTC (rev 6650)
@@ -4666,6 +4666,7 @@
 Defining \__tl_change_case_cs:N on line ...
 Defining \__tl_change_case_cs:NN on line ...
 Defining \__tl_change_case_cs:NNn on line ...
+Defining \__tl_change_case_protect:wNN on line ...
 Defining \__tl_change_case_if_expandable:NTF on line ...
 Defining \__tl_change_case_cs_expand:Nnw on line ...
 Defining \__tl_change_case_cs_expand:NN on line ...

Modified: trunk/l3kernel/testfiles/m3tl013.luatex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3tl013.luatex.tlg	2016-08-14 11:14:44 UTC (rev 6649)
+++ trunk/l3kernel/testfiles/m3tl013.luatex.tlg	2016-08-14 12:17:20 UTC (rev 6650)
@@ -184,3 +184,10 @@
 \"{A}\u {E}\H {I}\v {O}\.{U}
 \"{A}\u {e}\H {i}\v {o}\.{u}
 ============================================================
+============================================================
+TEST 19: Protect
+============================================================
+\protect \bfseries  \protect \underline {ab}
+\protect \bfseries  \protect \underline {AB}
+\protect \bfseries  \protect \underline {Ab}
+============================================================

Modified: trunk/l3kernel/testfiles/m3tl013.lvt
===================================================================
--- trunk/l3kernel/testfiles/m3tl013.lvt	2016-08-14 11:14:44 UTC (rev 6649)
+++ trunk/l3kernel/testfiles/m3tl013.lvt	2016-08-14 12:17:20 UTC (rev 6650)
@@ -209,4 +209,9 @@
     \test:n { \"{a} \u{e} \H{i} \v{o} \.{u} }
   }
 
+\TESTEXP { Protect }
+  {
+    \test:n { \bfseries \protect \underline {aB} }
+  }
+
 \END

Modified: trunk/l3kernel/testfiles/m3tl013.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3tl013.tlg	2016-08-14 11:14:44 UTC (rev 6649)
+++ trunk/l3kernel/testfiles/m3tl013.tlg	2016-08-14 12:17:20 UTC (rev 6650)
@@ -179,3 +179,10 @@
 \"{A}\u {E}\H {I}\v {O}\.{U}
 \"{A}\u {e}\H {i}\v {o}\.{u}
 ============================================================
+============================================================
+TEST 19: Protect
+============================================================
+\protect \bfseries  \protect \underline {ab}
+\protect \bfseries  \protect \underline {AB}
+\protect \bfseries  \protect \underline {Ab}
+============================================================

Modified: trunk/l3kernel/testfiles/m3tl013.uptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3tl013.uptex.tlg	2016-08-14 11:14:44 UTC (rev 6649)
+++ trunk/l3kernel/testfiles/m3tl013.uptex.tlg	2016-08-14 12:17:20 UTC (rev 6650)
@@ -182,3 +182,10 @@
 \"{A}\u {E}\H {I}\v {O}\.{U}
 \"{A}\u {e}\H {i}\v {o}\.{u}
 ============================================================
+============================================================
+TEST 19: Protect
+============================================================
+\protect \bfseries  \protect \underline {ab}
+\protect \bfseries  \protect \underline {AB}
+\protect \bfseries  \protect \underline {Ab}
+============================================================

Modified: trunk/l3kernel/testfiles/m3tl013.xetex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3tl013.xetex.tlg	2016-08-14 11:14:44 UTC (rev 6649)
+++ trunk/l3kernel/testfiles/m3tl013.xetex.tlg	2016-08-14 12:17:20 UTC (rev 6650)
@@ -179,3 +179,10 @@
 \"{A}\u {E}\H {I}\v {O}\.{U}
 \"{A}\u {e}\H {i}\v {o}\.{u}
 ============================================================
+============================================================
+TEST 19: Protect
+============================================================
+\protect \bfseries  \protect \underline {ab}
+\protect \bfseries  \protect \underline {AB}
+\protect \bfseries  \protect \underline {Ab}
+============================================================



More information about the latex3-commits mailing list