[latex3-commits] [git/LaTeX3-latex3-latex2e] utf-8-protected: Update MakeUppercase to match the protected utf-8 (164dfafc)
David Carlisle
d.p.carlisle at gmail.com
Sun Feb 20 14:54:32 CET 2022
Repository : https://github.com/latex3/latex2e
On branch : utf-8-protected
Link : https://github.com/latex3/latex2e/commit/164dfafc5f0b26de36d152cf3fb802fa2dc966ba
>---------------------------------------------------------------
commit 164dfafc5f0b26de36d152cf3fb802fa2dc966ba
Author: David Carlisle <d.p.carlisle at gmail.com>
Date: Sun Feb 20 13:54:32 2022 +0000
Update MakeUppercase to match the protected utf-8
>---------------------------------------------------------------
164dfafc5f0b26de36d152cf3fb802fa2dc966ba
base/doc/ltnews35.tex | 9 +++++++++
base/ltfinal.dtx | 33 +++++++++++++++++++++++----------
2 files changed, 32 insertions(+), 10 deletions(-)
diff --git a/base/doc/ltnews35.tex b/base/doc/ltnews35.tex
index 92b8a0f5..df5aa406 100644
--- a/base/doc/ltnews35.tex
+++ b/base/doc/ltnews35.tex
@@ -328,6 +328,15 @@ The characters defined via \file{utf8.def} are now defined as \cs{protected}
macros. This makes them safe to use in expansion contexts where the
classic \cs{protect} mechanism is not enabled, notably L3 programming
layer \texttt{e} and \texttt{x} arguments.
+
+Related to this change \cs{MakeUppercase} and \cs{MakeLowercase} have
+been updated to use the Unicode-aware case changing functions
+\cs{text\string_lowercase:n} in place of the \TeX-primitive \cs{lowercase}.
+A similar chaneg will be made in the \pkg{textcase} package.
+
+Note for technical reasons these low level character handling changes
+will not be rolled back if the format version is rolled back using the
+\pkg{latexrelease} package rollback mechanism.
%
\githubissue{780}
diff --git a/base/ltfinal.dtx b/base/ltfinal.dtx
index 46c7ded4..af7b82fa 100644
--- a/base/ltfinal.dtx
+++ b/base/ltfinal.dtx
@@ -33,7 +33,7 @@
%<*driver>
% \fi
\ProvidesFile{ltfinal.dtx}
- [2021/12/07 v2.2q LaTeX Kernel (Final Settings)]
+ [2022/02/20 v2.2r LaTeX Kernel (Final Settings)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltfinal.dtx}
@@ -1037,10 +1037,14 @@
% \begin{macro}{\MakeUppercase}
% \begin{macro}{\MakeUppercase}
% \begin{macro}{\@uclclist}
+% \begin{macro}{\@text at lowercase}
+% \begin{macro}{\@text at uppercase}
+% \begin{macro}{\@uclclist}
+%
%
% \changes{v1.1a}{1997/10/20}{Removed \cs{aa} and \cs{AA} from
% \cs{@uclclist} as these are macros.}
-%
+% \changes{v2.2r}{2022/02/20}{use \cs{text_lowercase:n}}%
% And whilst we're doing things with uc/lc tables, here are two
% commands to upper- and lower-case a string.
%
@@ -1051,7 +1055,18 @@
% mathematics, environment names, labels, etc. A much better
% long-term solution is to use all-caps fonts, but these aren't
% generally available.
+%
+% Two wrappers around the L3 case changing functions.
+% |\protected| to make them mostly safe as replacemenst for |luppercase|
+% and |\lowercase|.
% \begin{macrocode}
+\ExplSyntaxOn
+\protected\def\@text at lowercase{\text_lowercase:n}
+\protected\def\@text at uppercase{\text_uppercase:n}
+\ExplSyntaxOff
+% \end{macrocode}
+
+%% \begin{macrocode}
\DeclareRobustCommand{\MakeUppercase}[1]{{%
\def\i{I}\def\j{J}%
\def\reserved at a##1##2{\let##1##2\reserved at a}%
@@ -1059,20 +1074,16 @@
% \end{macrocode}
% Tell UTF-8 processing to process chars even though we are in an \cs{protected at edef}.
% \changes{v2.1h}{2019/09/14}{Expand UTF8 chars when case changing (github/177)}
+% \changes{v2.2r}{2022/02/20}
+% {Use \cs{@text at uppercase}, removing local redefinition of \cs{UTF at two@octets at noexpand}}%
% \begin{macrocode}
- \let\UTF at two@octets at noexpand\@empty
- \let\UTF at three@octets at noexpand\@empty
- \let\UTF at four@octets at noexpand\@empty
- \protected at edef\reserved at a{\uppercase{#1}}%
+ \protected at edef\reserved at a{\@text at uppercase{#1}}%
\reserved at a
}}
\DeclareRobustCommand{\MakeLowercase}[1]{{%
\def\reserved at a##1##2{\let##2##1\reserved at a}%
\expandafter\reserved at a\@uclclist\reserved at b{\reserved at b\@gobble}%
- \let\UTF at two@octets at noexpand\@empty
- \let\UTF at three@octets at noexpand\@empty
- \let\UTF at four@octets at noexpand\@empty
- \protected at edef\reserved at a{\lowercase{#1}}%
+ \protected at edef\reserved at a{\@text at lowercase{#1}}%
\reserved at a
}}
% \end{macrocode}
@@ -1108,6 +1119,8 @@
% \end{macro}
% \end{macro}
% \end{macro}
+% \end{macro}
+% \end{macro}
%
% \changes{v1.0h}{1994/05/13}{Added output enc stuff}
% \changes{v1.0i}{1994/05/16}{moved output enc stuff to lfonts}
More information about the latex3-commits
mailing list.