[latex3-commits] [git/LaTeX3-latex3-babel] main: A new counters* for lua. Close #210. (80b661a)

Javier email at dante.de
Tue Dec 20 18:54:58 CET 2022


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

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

commit 80b661afc0bd8aed1c2ae50bce11f4721182bb59
Author: Javier <email at localhost>
Date:   Tue Dec 20 18:54:58 2022 +0100

    A new counters* for lua. Close #210.


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

80b661afc0bd8aed1c2ae50bce11f4721182bb59
 README.md    |   2 +-
 babel.dtx    | 118 +++++++++++++++++++++++++++++++----------------------------
 babel.ins    |   2 +-
 babel.pdf    | Bin 900858 -> 900809 bytes
 bbcompat.dtx |   2 +-
 5 files changed, 66 insertions(+), 58 deletions(-)

diff --git a/README.md b/README.md
index 7e0b11d..40f268f 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-## Babel 3.83.2953
+## Babel 3.83.2957
 
 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 6c3a2e1..fb31c70 100644
--- a/babel.dtx
+++ b/babel.dtx
@@ -32,7 +32,7 @@
 %
 % \iffalse
 %<*filedriver>
-\ProvidesFile{babel.dtx}[2022/12/16 v3.83.2953 The Babel package]
+\ProvidesFile{babel.dtx}[2022/12/20 v3.83.2957 The Babel package]
 \documentclass{ltxdoc}
 \GetFileInfo{babel.dtx}
 \usepackage{fontspec}
@@ -4421,8 +4421,8 @@ Some recommendations:
   also use the new tools for encoded strings, described below.
 \item Avoid adding things to |\noextras|\m{lang} except for umlauthigh
   and friends, |\bbl at deactivate|, |\bbl@(non)frenchspacing|, and
-  language-specific macros. Use always, if possible, |\bbl at save| and
-  |\bbl at savevariable| (except if you still want to have access to the
+  language-specific macros. Use always, if possible, |\babel at save| and
+  |\babel at savevariable| (except if you still want to have access to the
   previous value). Do not reset a macro or a setting to a hardcoded
   value. Never. Instead save its value in |\extras|\m{lang}.
 \item Do not switch scripts. If you want to make sure a set of glyphs
@@ -5194,8 +5194,8 @@ help from Bernd Raichle, for which I am grateful.
 % \section{Tools}
 %
 %    \begin{macrocode}
-%<<version=3.83.2953>>
-%<<date=2022/12/16>>
+%<<version=3.83.2957>>
+%<<date=2022/12/20>>
 %    \end{macrocode}
 %
 % \textbf{Do not use the following macros in \texttt{ldf} files. They
@@ -5526,16 +5526,6 @@ help from Bernd Raichle, for which I am grateful.
   \fi}
 %    \end{macrocode}
 %
-% An alternative to |\IfFormatAtLeastTF| for old versions. Temporary.
-%
-%    \begin{macrocode}  
-\ifx\IfFormatAtLeastTF\@undefined
-  \def\bbl at ifformatlater{\@ifl at t@r\fmtversion}
-\else
-  \let\bbl at ifformatlater\IfFormatAtLeastTF
-\fi
-%    \end{macrocode}
-%
 % The following adds some code to |\extras...| both before and after,
 % while avoiding doing it twice. It's somewhat convoluted, to deal with
 % |#|'s. Used to deal with alph, Alph and frenchspacing when there are
@@ -11320,6 +11310,8 @@ help from Bernd Raichle, for which I am grateful.
     \expandafter\babel at aux\expandafter{\bbl at main@language}{}}%
   \let\bbl at restorelastskip\relax
   \def\bbl at savelastskip##1\bbl at restorelastskip{}}
+\@namedef{bbl at ADJ@encoding.select at off}{%
+  \let\bbl at encoding@select at off\@empty}
 %    \end{macrocode}
 %
 % As the final task, load the code for lua. TODO: use babel name, override 
@@ -13360,6 +13352,16 @@ help from Bernd Raichle, for which I am grateful.
 %      think there must be a better way.
 %
 %    \begin{macrocode}
+\IfBabelLayout{counters*}%
+  {\bbl at add\bbl at opt@layout{.counters.}%
+   \AddToHook{shipout/before}{%
+     \let\bbl at tempa\babelsublr
+     \let\babelsublr\@firstofone
+     \let\bbl at save@thepage\thepage
+     \protected at edef\thepage{\thepage}%
+     \let\babelsublr\bbl at tempa}%
+   \AddToHook{shipout/after}{%
+     \let\thepage\bbl at save@thepage}}{}
 \IfBabelLayout{counters}%
   {\let\bbl at latinarabic=\@arabic
    \def\@arabic#1{\babelsublr{\bbl at latinarabic#1}}%
@@ -13379,39 +13381,41 @@ help from Bernd Raichle, for which I am grateful.
 %    \begin{macrocode}
 %<*texxet>
 \def\bbl at provide@extra#1{%
-  % == auto-select encoding == WIP. TODO: Consider main T2A -> T1
-  \bbl at ifunset{bbl at encoding@#1}%
-    {\def\@elt##1{,##1,}%
-     \edef\bbl at tempe{\expandafter\@gobbletwo\@fontenc at load@list}%
-     \count@\z@
-     \bbl at foreach\bbl at tempe{%
-       \def\bbl at tempd{##1}%  Save last declared
-       \advance\count@\@ne}%
-     \ifnum\count@>\@ne
-       \getlocaleproperty*\bbl at tempa{#1}{identification/encodings}%
-       \ifx\bbl at tempa\relax \let\bbl at tempa\@empty \fi
-       \bbl at replace\bbl at tempa{ }{,}%
-       \global\bbl at csarg\let{encoding@#1}\@empty
-       \bbl at xin@{,\bbl at tempd,}{,\bbl at tempa,}%
-       \ifin@\else % if main encoding included in ini, do nothing
-         \let\bbl at tempb\relax
-         \bbl at foreach\bbl at tempa{%
-           \ifx\bbl at tempb\relax
-             \bbl at xin@{,##1,}{,\bbl at tempe,}%
-             \ifin@\def\bbl at tempb{##1}\fi
-           \fi}%
-         \ifx\bbl at tempb\relax\else
-           \bbl at exp{%
-             \global\<bbl at add>\<bbl at preextras@#1>{\<bbl at encoding@#1>}%
-           \gdef\<bbl at encoding@#1>{%
-             \\\babel at save\\\f at encoding
-             \\\bbl at add\\\originalTeX{\\\selectfont}%
-             \\\fontencoding{\bbl at tempb}%
-             \\\selectfont}}%
+  % == auto-select encoding ==
+  \ifx\bbl at encoding@select at off\@empty\else
+    \bbl at ifunset{bbl at encoding@#1}%
+      {\def\@elt##1{,##1,}%
+       \edef\bbl at tempe{\expandafter\@gobbletwo\@fontenc at load@list}%
+       \count@\z@
+       \bbl at foreach\bbl at tempe{%
+         \def\bbl at tempd{##1}%  Save last declared
+         \advance\count@\@ne}%
+       \ifnum\count@>\@ne
+         \getlocaleproperty*\bbl at tempa{#1}{identification/encodings}%
+         \ifx\bbl at tempa\relax \let\bbl at tempa\@empty \fi
+         \bbl at replace\bbl at tempa{ }{,}%
+         \global\bbl at csarg\let{encoding@#1}\@empty
+         \bbl at xin@{,\bbl at tempd,}{,\bbl at tempa,}%
+         \ifin@\else % if main encoding included in ini, do nothing
+           \let\bbl at tempb\relax
+           \bbl at foreach\bbl at tempa{%
+             \ifx\bbl at tempb\relax
+               \bbl at xin@{,##1,}{,\bbl at tempe,}%
+               \ifin@\def\bbl at tempb{##1}\fi
+             \fi}%
+           \ifx\bbl at tempb\relax\else
+             \bbl at exp{%
+               \global\<bbl at add>\<bbl at preextras@#1>{\<bbl at encoding@#1>}%
+             \gdef\<bbl at encoding@#1>{%
+               \\\babel at save\\\f at encoding
+               \\\bbl at add\\\originalTeX{\\\selectfont}%
+               \\\fontencoding{\bbl at tempb}%
+               \\\selectfont}}%
+           \fi
          \fi
-       \fi
-     \fi}%
- {}}
+       \fi}%
+      {}%
+  \fi}
 %</texxet>
 %    \end{macrocode}
 %
@@ -13724,6 +13728,14 @@ help from Bernd Raichle, for which I am grateful.
         Babel.script_blocks[script], {tonumber(s,16), tonumber(e,16)})
     end
   end
+  function Babel.discard_sublr(str)
+    if str:find( [[\string\indexentry]] ) and
+         str:find( [[\string\babelsublr]] ) then
+     str = str:gsub( [[\string\babelsublr%s*(%b{})]],
+                     function(m) return m:sub(2,-2) end )
+   end
+   return str 
+end
 }
 \endgroup
 \ifx\newattribute\@undefined\else
@@ -15116,14 +15128,10 @@ end
 %    \begin{macrocode}
 \IfBabelLayout{counters*}%
   {\bbl at add\bbl at opt@layout{.counters.}%
-   \AddToHook{shipout/before}{%
-     \let\bbl at tempa\babelsublr
-     \let\babelsublr\@firstofone
-     \let\bbl at save@thepage\thepage
-     \protected at edef\thepage{\thepage}%
-     \let\babelsublr\bbl at tempa}%
-   \AddToHook{shipout/after}{%
-     \let\thepage\bbl at save@thepage}}{}
+   \directlua{
+     luatexbase.add_to_callback("process_output_buffer",
+       Babel.discard_sublr , "Babel.discard_sublr") }%
+  }{}
 \IfBabelLayout{counters}%
   {\let\bbl at OL@@textsuperscript\@textsuperscript
    \bbl at sreplace\@textsuperscript{\m at th}{\m at th\mathdir\pagedir}%
diff --git a/babel.ins b/babel.ins
index e7e8a83..b8186f2 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{2022/12/16}
+\def\filedate{2022/12/20}
 \def\batchfile{babel.ins}
 \input docstrip.tex
 
diff --git a/babel.pdf b/babel.pdf
index 0dbd573..2ab8b18 100644
Binary files a/babel.pdf and b/babel.pdf differ
diff --git a/bbcompat.dtx b/bbcompat.dtx
index 532cfe5..8e94172 100644
--- a/bbcompat.dtx
+++ b/bbcompat.dtx
@@ -30,7 +30,7 @@
 %
 % \iffalse
 %<*dtx>
-\ProvidesFile{bbcompat.dtx}[2022/12/16 v3.83.2953]
+\ProvidesFile{bbcompat.dtx}[2022/12/20 v3.83.2957]
 %</dtx>
 %
 %% File 'bbcompat.dtx'





More information about the latex3-commits mailing list.