[latex3-commits] [git/LaTeX3-latex3-babel] main: Partial support for \AddToHook. Use the new selectfont hook. (faa6765)

Javier email at dante.de
Fri Jul 16 19:09:18 CEST 2021


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

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

commit faa6765ff792eb1ccbd7077c610ff03bee1c7527
Author: Javier <email at localhost>
Date:   Fri Jul 16 19:09:18 2021 +0200

    Partial support for \AddToHook. Use the new selectfont hook.


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

faa6765ff792eb1ccbd7077c610ff03bee1c7527
 README.md    |   2 +-
 babel.dtx    |  50 ++++++++++++++++++++++++++++++++++++--------------
 babel.ins    |   2 +-
 babel.pdf    | Bin 850773 -> 850817 bytes
 bbcompat.dtx |   2 +-
 5 files changed, 39 insertions(+), 17 deletions(-)

diff --git a/README.md b/README.md
index 3d53d2e..d925088 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-## Babel 3.61.2431
+## Babel 3.61.2435
 
 This package manages culturally-determined typographical (and other)
 rules, and hyphenation patterns for a wide range of languages. Many
diff --git a/babel.dtx b/babel.dtx
index b9b80fd..55fe976 100644
--- a/babel.dtx
+++ b/babel.dtx
@@ -32,7 +32,7 @@
 %
 % \iffalse
 %<*filedriver>
-\ProvidesFile{babel.dtx}[2021/07/12 v3.61.2431 The Babel package]
+\ProvidesFile{babel.dtx}[2021/07/16 v3.61.2435 The Babel package]
 \documentclass{ltxdoc}
 \GetFileInfo{babel.dtx}
 \usepackage{fontspec}
@@ -4990,8 +4990,8 @@ help from Bernd Raichle, for which I am grateful.
 % \section{Tools}
 %
 %    \begin{macrocode}
-%<<version=3.61.2431>>
-%<<date=2021/07/12>>
+%<<version=3.61.2435>>
+%<<date=2021/07/16>>
 %    \end{macrocode}
 %
 % \textbf{Do not use the following macros in \texttt{ldf} files. They
@@ -6464,6 +6464,26 @@ help from Bernd Raichle, for which I am grateful.
 \fi
 %    \end{macrocode}
 %
+% For several functionalities, we need to execute some code with
+% |\selectfont|. Currently, there is a hook for this purpose, but for
+% older versions the \LaTeX{} command is patched (the latter solution
+% will be eventually removed).
+%
+%    \begin{macrocode}
+\begingroup
+  \catcode`\_=11
+  \catcode`\.=10
+  \catcode`\ =11\relax%   Spaces as letters!
+..\ifx\__hook selectfont\@undefined%
+....\gdef\bbl at patchfont#1{%
+......\expandafter\bbl at add\csname.selectfont.\endcsname{#1}%
+......\expandafter\bbl at toglobal\csname.selectfont.\endcsname}%
+..\else%
+....\gdef\bbl at patchfont#1{\AddToHook{selectfont}{#1}}%
+..\fi%
+\endgroup
+%    \end{macrocode}
+%
 % \end{macro}
 %
 % \subsection{Basic bidi support}
@@ -8199,6 +8219,9 @@ help from Bernd Raichle, for which I am grateful.
 \newcommand\EnableBabelHook[1]{\bbl at csarg\let{hk@#1}\@firstofone}
 \newcommand\DisableBabelHook[1]{\bbl at csarg\let{hk@#1}\@gobble}
 \def\bbl at usehooks#1#2{%
+  \ifx\UseHook\@undefined\else
+    \UseHook{babel/#1}%
+  \fi
   \def\bbl at elth##1{%
     \bbl at cs{hk@##1}{\bbl at cs{ev@##1@#1@}#2}}%
   \bbl at cs{ev@#1@}%
@@ -8222,6 +8245,10 @@ help from Bernd Raichle, for which I am grateful.
   beforeextras=0,afterextras=0,stopcommands=0,stringprocess=0,%
   hyphenation=2,initiateactive=3,afterreset=0,foreign=0,foreign*=0,%
   beforestart=0,languagename=2}
+\ifx\NewHook\@undefined\else
+  \def\bbl at tempa#1=#2\@@{\NewHook{babel/#1}}
+  \bbl at foreach\bbl at evargs{\bbl at tempa#1\@@}
+\fi
 %    \end{macrocode}
 %
 % \begin{macro}{\babelensure}
@@ -10920,7 +10947,7 @@ help from Bernd Raichle, for which I am grateful.
         end}%
       \ifx\bbl at mapselect\@undefined  % TODO. almost the same as mapfont
         \AtBeginDocument{%
-          \expandafter\bbl at add\csname selectfont \endcsname{{\bbl at mapselect}}%
+          \bbl at patchfont{{\bbl at mapselect}}%
           {\selectfont}}%
         \def\bbl at mapselect{%
           \let\bbl at mapselect\relax
@@ -10948,7 +10975,7 @@ help from Bernd Raichle, for which I am grateful.
     \bbl at ifunset{bbl at wdir@\languagename}{\bbl at provide@dirs{\languagename}}{}%
     \ifx\bbl at mapselect\@undefined % TODO. See onchar. selectfont hook
       \AtBeginDocument{%
-        \expandafter\bbl at add\csname selectfont \endcsname{{\bbl at mapselect}}%
+        \bbl at patchfont{{\bbl at mapselect}}%
         {\selectfont}}%
       \def\bbl at mapselect{%
         \let\bbl at mapselect\relax
@@ -11933,10 +11960,8 @@ help from Bernd Raichle, for which I am grateful.
              \expandafter\@secondoftwo  % to execute right now
            \fi
            \AtBeginDocument{%
-             \expandafter\bbl at add
-             \csname selectfont \endcsname{\bbl at xenohyph}%
-             \expandafter\selectlanguage\expandafter{\languagename}%
-             \expandafter\bbl at toglobal\csname selectfont \endcsname}%
+             \bbl at patchfont{\bbl at xenohyph}%
+             \expandafter\selectlanguage\expandafter{\languagename}}%
         \fi}}%
   \fi
   \bbl at csarg\bbl at toglobal{lsys@#1}}
@@ -13051,10 +13076,7 @@ help from Bernd Raichle, for which I am grateful.
         \ifx\AtBeginDocument\@notprerr
           \expandafter\@secondoftwo  % to execute right now
         \fi
-        \AtBeginDocument{%
-          \expandafter\bbl at add
-          \csname selectfont \endcsname{\bbl at ispacesize}%
-          \expandafter\bbl at toglobal\csname selectfont \endcsname}%
+        \AtBeginDocument{\bbl at patchfont{\bbl at xenohyph}}%
       \fi}%
   \fi}
 \ifx\DisableBabelHook\@undefined\endinput\fi
@@ -13796,7 +13818,7 @@ help from Bernd Raichle, for which I am grateful.
   \newattribute\bblar at kashida
   \directlua{ Babel.attr_kashida = luatexbase.registernumber'bblar at kashida' }%
   \bblar at kashida=\z@
-  \expandafter\bbl at add\csname selectfont \endcsname{{\bbl at parsejalt}}%
+  \bbl at patchfont{{\bbl at parsejalt}}%
   \directlua{
     Babel.arabic.elong_map   = Babel.arabic.elong_map or {}
     Babel.arabic.elong_map[\the\localeid]   = {}
diff --git a/babel.ins b/babel.ins
index 6c0581f..ca4249a 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{2021/07/12}
+\def\filedate{2021/07/16}
 \def\batchfile{babel.ins}
 \input docstrip.tex
 
diff --git a/babel.pdf b/babel.pdf
index 3af929a..ecadd80 100644
Binary files a/babel.pdf and b/babel.pdf differ
diff --git a/bbcompat.dtx b/bbcompat.dtx
index b130044..4428758 100644
--- a/bbcompat.dtx
+++ b/bbcompat.dtx
@@ -30,7 +30,7 @@
 %
 % \iffalse
 %<*dtx>
-\ProvidesFile{bbcompat.dtx}[2021/07/12 v3.61.2431]
+\ProvidesFile{bbcompat.dtx}[2021/07/16 v3.61.2435]
 %</dtx>
 %
 %% File 'bbcompat.dtx'





More information about the latex3-commits mailing list.