[latex3-commits] [git/LaTeX3-latex3-latex3] main: Proper support for BCP 47 (c203378ec)

Joseph Wright joseph.wright at morningstar2.co.uk
Wed May 4 22:12:01 CEST 2022


Repository : https://github.com/latex3/latex3
On branch  : main
Link       : https://github.com/latex3/latex3/commit/c203378eca954f1c165a922ab736427d8648c787

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

commit c203378eca954f1c165a922ab736427d8648c787
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Wed May 4 21:12:01 2022 +0100

    Proper support for BCP 47


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

c203378eca954f1c165a922ab736427d8648c787
 l3kernel/CHANGELOG.md    |  3 +++
 l3kernel/l3text-case.dtx | 47 +++++++++++++++++++++++++++++++++++++++--------
 2 files changed, 42 insertions(+), 8 deletions(-)

diff --git a/l3kernel/CHANGELOG.md b/l3kernel/CHANGELOG.md
index 497aefd64..271ead805 100644
--- a/l3kernel/CHANGELOG.md
+++ b/l3kernel/CHANGELOG.md
@@ -11,6 +11,9 @@ this project uses date-based 'snapshot' version identifiers.
 - Language settings `hy` and `hy-x-yiwn` for handling of ech-yiwm ligature
   uppercasing
 
+## Changed
+- Support BCP 47 properly in case changer language argument
+
 ### Fixed
 - Correct `el-xiota` and `de-xeszett` to `el-x-iota` and `de-x-eszett`
 
diff --git a/l3kernel/l3text-case.dtx b/l3kernel/l3text-case.dtx
index 94c22ae48..7371e21d0 100644
--- a/l3kernel/l3text-case.dtx
+++ b/l3kernel/l3text-case.dtx
@@ -110,7 +110,15 @@
 % \end{macro}
 % \end{macro}
 %
-% \begin{macro}[EXP]{\@@_change_case:nnn, \@@_change_case_aux:nnn}
+% \begin{macro}[EXP]
+%   {
+%     \@@_change_case:nnn      ,
+%     \@@_change_case_auxi:nnn ,
+%     \@@_change_case_auxii:nnn
+%   }
+% \begin{macro}[EXP]{\@@_change_case_BCP:nnn}
+% \begin{macro}[EXP]{\@@_change_case_BCP:nnw}
+% \begin{macro}[EXP]{\@@_change_case_BCP:nnnnw}
 % \begin{macro}[EXP]
 %   {
 %     \@@_change_case_store:n, \@@_change_case_store:o,
@@ -207,12 +215,32 @@
      \__kernel_exp_not:w \exp_after:wN
       {
         \exp:w
-        \exp_args:Ne \@@_change_case_aux:nnn
+        \exp_args:Ne \@@_change_case_auxi:nnn
           { \text_expand:n {#3} }
           {#1} {#2}
       }
   }
-\cs_new:Npn \@@_change_case_aux:nnn #1#2#3
+\cs_new:Npn \@@_change_case_auxi:nnn #1#2#3
+  { \exp_args:No \@@_change_case_BCP:nnn { \tl_to_str:n {#3} } {#1} {#2} }
+\cs_new:Npx \@@_change_case_BCP:nnn #1#2#3
+  {
+    \exp_not:N \@@_change_case_BCP:nnw
+      {#2} {#3} #1 \tl_to_str:n { -x- -x- } \exp_not:N \q_@@_stop
+  }
+\use:x
+  {
+    \cs_new:Npn \exp_not:N \@@_change_case_BCP:nnw
+      ##1##2##3 \tl_to_str:n { -x- } ##4 \tl_to_str:n { -x- } ##5
+      \exp_not:N \q_@@_stop
+  }
+  { \@@_change_case_BCP:nnnnw {#1} {#2} {#4} {#3} #3 - - \q_@@_stop }
+\cs_new:Npn \@@_change_case_BCP:nnnnw #1#2#3#4#5 - #6 - #7 \q_@@_stop
+  {
+    \cs_if_exist:cTF { @@_change_case_ #2 _ #5 -x- #3 :nnnN }
+      { \@@_change_case_auxii:nnn {#1} {#2} { #5 -x- #3 } }
+      { \@@_change_case_auxii:nnn {#1} {#2} {#4} }
+  }
+\cs_new:Npn \@@_change_case_auxii:nnn #1#2#3
   {
     \group_align_safe_begin:
     \cs_if_exist_use:c { @@_change_case_boundary_ #2 _ #3 :Nnnw }
@@ -269,7 +297,7 @@
         \exp_after:wN
           {
             \exp:w
-            \@@_change_case_aux:nnn {#3} {#1} {#2}
+            \@@_change_case_auxii:nnn {#3} {#1} {#2}
           }
       }
     \@@_change_case_loop:nnw {#1} {#2}
@@ -283,7 +311,7 @@
         \exp_after:wN
           {
             \exp:w
-            \@@_change_case_aux:nnn {#3} {#1} {#2}
+            \@@_change_case_auxii:nnn {#3} {#1} {#2}
           }
       }
     \@@_change_case_loop:nnw { lower } {#2}
@@ -295,7 +323,7 @@
         \exp_after:wN
           {
             \exp:w
-            \@@_change_case_aux:nnn {#3} {#1} {#2}
+            \@@_change_case_auxii:nnn {#3} {#1} {#2}
           }
       }
     \@@_change_case_break:w
@@ -731,6 +759,9 @@
 % \end{macro}
 % \end{macro}
 % \end{macro}
+% \end{macro}
+% \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}
@@ -1267,9 +1298,9 @@
           }
           { \@@_change_case_char:nnnN {#1} {#2} {#3} #4 }
       }
-    \cs_new:cpn { @@_change_case_upper_hy-x-yiwm:nnnN } #1#2#3#4
+    \cs_new:cpn { @@_change_case_upper_hy-x-yiwn:nnnN } #1#2#3#4
       { \@@_change_case_char:nnnN {#1} {#2} {#3} #4 }
-    \cs_new_eq:cc { @@_change_case_title_hy-x-yiwm:nnnN }
+    \cs_new_eq:cc { @@_change_case_title_hy-x-yiwn:nnnN }
       { @@_change_case_upper_hy-x-yiwm:nnnN }
   }
 %    \end{macrocode}





More information about the latex3-commits mailing list.