[latex3-commits] [git/LaTeX3-latex3-babel] main: Close #153 (select justification mode by font) (77ca8ef)

Javier email at dante.de
Sun Jan 8 15:13:15 CET 2023


Repository : https://github.com/latex3/babel
On branch  : main
Link       : https://github.com/latex3/babel/commit/77ca8efe6a7cc682487cbd239a134c694cba7914

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

commit 77ca8efe6a7cc682487cbd239a134c694cba7914
Author: Javier <email at localhost>
Date:   Sun Jan 8 15:13:15 2023 +0100

    Close #153 (select justification mode by font)
    
    Also: fix \babelprehyphenation with onchar.


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

77ca8efe6a7cc682487cbd239a134c694cba7914
 README.md    |   4 +-
 babel.dtx    | 127 ++++++++++++++++++++++++++++++-----------------------------
 babel.ins    |   2 +-
 babel.pdf    | Bin 906889 -> 906706 bytes
 bbcompat.dtx |   2 +-
 5 files changed, 69 insertions(+), 66 deletions(-)

diff --git a/README.md b/README.md
index 58bf3d1..e363e0f 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-## Babel 3.84.2970
+## Babel 3.84.2976
 
 (dev)
 
@@ -52,6 +52,8 @@ respective authors.
       * Spaces allowed as separators in layout=.
       * A high-level interface to enable and disable transforms (lua).
       * Font-dependent transforms (lua).
+      * Fixes:
+        - \babelprehyphenation was not applied with 'onchar'.
       
 3.84  2022-12-26
       * Automatic selection of encodings with \babelprovide and pdftex.
diff --git a/babel.dtx b/babel.dtx
index 716e45f..ef7937b 100644
--- a/babel.dtx
+++ b/babel.dtx
@@ -32,7 +32,7 @@
 %
 % \iffalse
 %<*filedriver>
-\ProvidesFile{babel.dtx}[2023/01/02 v3.84.2970 The Babel package]
+\ProvidesFile{babel.dtx}[2023/01/08 v3.84.2976 The Babel package]
 \documentclass{ltxdoc}
 \GetFileInfo{babel.dtx}
 \usepackage{fontspec}
@@ -5246,8 +5246,8 @@ help from Bernd Raichle, for which I am grateful.
 % \section{Tools}
 %
 %    \begin{macrocode}
-%<<version=3.84.2970>>
-%<<date=2023/01/02>>
+%<<version=3.84.2976>>
+%<<date=2023/01/08>>
 %    \end{macrocode}
 %
 % \textbf{Do not use the following macros in \texttt{ldf} files. They
@@ -8790,26 +8790,6 @@ help from Bernd Raichle, for which I am grateful.
       {\bbl at tolower\@empty}{\bbl at toupper\@empty}}%
     \gdef\bbl at tolower{\csname\languagename @bbl at lc\endcsname}%
     \gdef\bbl at toupper{\csname\languagename @bbl at uc\endcsname}}}
-% A temporary hack, for testing purposes:
-\def\BabelRestoreCase{%
-  \DeclareRobustCommand{\MakeUppercase}[1]{{%
-    \def\reserved at a####1####2{\let####1####2\reserved at a}%
-    \def\i{I}\def\j{J}%
-    \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{\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}}%
-    \reserved at a}}}
 %    \end{macrocode}
 %
 %    \begin{macrocode}
@@ -9905,7 +9885,7 @@ help from Bernd Raichle, for which I am grateful.
     \directlua{
       if Babel.locale_mapped == nil then
         Babel.locale_mapped = true
-        Babel.linebreaking.add_before(Babel.locale_map)
+        Babel.linebreaking.add_before(Babel.locale_map, 1)
         Babel.loc_to_scr = {}
         Babel.chr_to_loc = Babel.chr_to_loc or {}
       end
@@ -13081,7 +13061,7 @@ help from Bernd Raichle, for which I am grateful.
             \global\let\<bbl@##1dflt@\languagename>%
                        \<bbl@##1dflt@*\bbl at tempa>}}}%
       {}}%                               1=T - language, already defined
-  \def\bbl at tempa{\bbl at nostdfont{}}%
+  \def\bbl at tempa{\bbl at nostdfont{}}%  TODO. Don't use \bbl at tempa
   \bbl at foreach\bbl at font@fams{%     don't gather with prev for
     \bbl at ifunset{bbl@##1dflt@\languagename}%
       {\bbl at cs{famrst@##1}%
@@ -13914,9 +13894,13 @@ end
   Babel.linebreaking.before = {}
   Babel.linebreaking.after = {}
   Babel.locale = {} % Free to use, indexed by \localeid
-  function Babel.linebreaking.add_before(func)
+  function Babel.linebreaking.add_before(func, pos)
     tex.print([[\noexpand\csname bbl at luahyphenate\endcsname]])
-    table.insert(Babel.linebreaking.before, func)
+    if pos == nil then
+      table.insert(Babel.linebreaking.before, func)
+    else
+      table.insert(Babel.linebreaking.before, pos, func)
+    end
   end
   function Babel.linebreaking.add_after(func)
     tex.print([[\noexpand\csname bbl at luahyphenate\endcsname]])
@@ -14645,30 +14629,34 @@ end
         \fi}}&% 
     \let\bbl at kv@attribute\relax
     \let\bbl at kv@label\relax
-    \let\bbl at kv@fonts\relax
+    \let\bbl at kv@fonts\@empty
     \bbl at forkv{#2}{\bbl at csarg\edef{kv@##1}{##2}}&%
+    \ifx\bbl at kv@fonts\@empty\else\bbl at settransfont\fi
     \ifx\bbl at kv@attribute\relax
       \ifx\bbl at kv@label\relax\else  
-        \edef\bbl at kv@attribute{bbl at ATR@\bbl at kv@label @#3}&%
+        \bbl at exp{\\\bbl at trim@def\\\bbl at kv@fonts{\bbl at kv@fonts}}&%
+        \bbl at replace\bbl at kv@fonts{ }{,}&%
+        \edef\bbl at kv@attribute{bbl at ATR@\bbl at kv@label @#3@\bbl at kv@fonts}&%
+        \count@\z@
+        \def\bbl at elt##1##2##3{&%
+          \bbl at ifsamestring{#3,\bbl at kv@label}{##1,##2}&%
+            {\bbl at ifsamestring{\bbl at kv@fonts}{##3}&%
+               {\count@\@ne}&%
+               {\bbl at error
+                 {Transforms cannot be re-assigned to different\\&%
+                  fonts. The conflict is in '\bbl at kv@label'.\\&%
+                  Apply the same fonts or use a different label}&%
+                 {See the manual for further details.}}}&%
+            {}}&%
+        \bbl at transfont@list
+        \ifnum\count@=\z@
+          \bbl at exp{\global\\\bbl at add\\\bbl at transfont@list
+            {\\\bbl at elt{#3}{\bbl at kv@label}{\bbl at kv@fonts}}}&%
+        \fi
         \bbl at ifunset{\bbl at kv@attribute}&%
           {\global\bbl at carg\newattribute{\bbl at kv@attribute}}&%
           {}&%
         \global\bbl at carg\setattribute{\bbl at kv@attribute}\@ne
-        \ifx\bbl at kv@fonts\relax
-          \bbl at exp{&%
-            \global\\\bbl at add\\\bbl at dotransfont{&%
-              \\\bbl at elt{#3}{}{\bbl at kv@label}}}&%
-        \else
-          \bbl at settransfont
-          \bbl at replace\bbl at kv@fonts{ }{,}&%
-          \bbl at exp{&% TODO. Now redundant entries are created
-            \global\\\bbl at add\\\bbl at untransfont{&%
-              \\\disablelocaletransform{\bbl at kv@label}}}&%
-          \bbl at foreach\bbl at kv@fonts{&%
-            \bbl at exp{&%
-              \global\\\bbl at add\\\bbl at dotransfont{&%
-                \\\bbl at elt{#3}{##1}{\bbl at kv@label}}}}&%
-        \fi
       \fi
     \else
       \edef\bbl at kv@attribute{\expandafter\bbl at stripslash\bbl at kv@attribute}&%
@@ -14716,25 +14704,28 @@ end
     }&%
   \endgroup}
 \endgroup
-\let\bbl at dotransfont\@empty
+\let\bbl at transfont@list\@empty
 \def\bbl at settransfont{%
   \global\let\bbl at settransfont\relax % Execute only once
-  \global\let\bbl at untransfont\@empty
   \gdef\bbl at transfont{%
-    \bbl at untransfont
     \def\bbl at elt####1####2####3{%
-      \bbl at ifsamestring{####1}{\languagename}%
-        {\bbl at ifsamestring{####2}\bbl at transfam
-          {\enablelocaletransform{####3}}%
-          {}%
-        \bbl at ifsamestring{####2}{}%
-          {\enablelocaletransform{####3}}%
-          {}%
-        \bbl at ifsamestring{####2}{\bbl at transfam/\f at series/\f at shape}%
-          {\enablelocaletransform{####3}}%
-          {}}%
-        {}}%
-    \bbl at dotransfont}%
+      \bbl at ifblank{####3}%
+         {\count@\tw@}% Do nothing if no fonts
+         {\count@\z@
+          \bbl at vforeach{####3}{%
+            \def\bbl at tempd{########1}%
+            \edef\bbl at tempe{\bbl at transfam/\f at series/\f at shape}%
+            \ifx\bbl at tempd\bbl at tempe
+              \count@\@ne
+            \else\ifx\bbl at tempd\bbl at transfam
+              \count@\@ne
+            \fi\fi}%
+         \ifcase\count@
+           \bbl at csarg\unsetattribute{ATR@####2@####1@####3}%
+         \or
+           \bbl at csarg\setattribute{ATR@####2@####1@####3}\@ne
+         \fi}}%
+      \bbl at transfont@list}%
   \AddToHook{selectfont}{\bbl at transfont}% Hooks are global.
   \gdef\bbl at transfam{-unknown-}%
   \bbl at foreach\bbl at font@fams{%
@@ -14742,10 +14733,20 @@ end
     \bbl at ifsamestring{\@nameuse{##1default}}\familydefault
       {\xdef\bbl at transfam{##1}}%
       {}}}
-\DeclareRobustCommand\enablelocaletransform[2][\languagename]{%
-  \bbl at ifunset{bbl at ATR@#2@#1}{}{\bbl at csarg\setattribute{ATR@#2@#1}\@ne}}
-\DeclareRobustCommand\disablelocaletransform[2][\languagename]{%
-  \bbl at ifunset{bbl at ATR@#2@#1}{}{\bbl at csarg\unsetattribute{ATR@#2@#1}}}
+\DeclareRobustCommand\enablelocaletransform[1]{%
+  \bbl at ifunset{bbl at ATR@#1@\languagename @}%
+    {\bbl at error
+       {'#1' for '\languagename' cannot be enabled.\\%
+        Maybe there is a typo or it’s a font-dependent transform}%
+       {See the manual for further details.}}% 
+    {\bbl at csarg\setattribute{ATR@#1@\languagename @}\@ne}}
+\DeclareRobustCommand\disablelocaletransform[1]{%
+  \bbl at ifunset{bbl at ATR@#1@\languagename @}%
+    {\bbl at error
+       {'#1' for '\languagename' cannot be disabled.\\%
+        Maybe there is a typo or it’s a font-dependent transform}%
+       {See the manual for further details.}}% 
+    {\bbl at csarg\unsetattribute{ATR@#1@\languagename @}}}
 \def\bbl at activateposthyphen{%
   \let\bbl at activateposthyphen\relax
   \directlua{
diff --git a/babel.ins b/babel.ins
index 8d71e3a..94f0407 100644
--- a/babel.ins
+++ b/babel.ins
@@ -26,7 +26,7 @@
 %% and covered by LPPL is defined by the unpacking scripts (with
 %% extension .ins) which are part of the distribution.
 %%
-\def\filedate{2023/01/02}
+\def\filedate{2023/01/08}
 \def\batchfile{babel.ins}
 \input docstrip.tex
 
diff --git a/babel.pdf b/babel.pdf
index 59698e4..bec130c 100644
Binary files a/babel.pdf and b/babel.pdf differ
diff --git a/bbcompat.dtx b/bbcompat.dtx
index a4199b1..af222e5 100644
--- a/bbcompat.dtx
+++ b/bbcompat.dtx
@@ -30,7 +30,7 @@
 %
 % \iffalse
 %<*dtx>
-\ProvidesFile{bbcompat.dtx}[2023/01/02 v3.84.2970]
+\ProvidesFile{bbcompat.dtx}[2023/01/08 v3.84.2976]
 %</dtx>
 %
 %% File 'bbcompat.dtx'





More information about the latex3-commits mailing list.