From 36878db7eaaefd0a2f92b7e6c951f3fecda7799c Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Fri, 28 Feb 2020 22:30:49 +0000
Subject: babel (28feb20)

git-svn-id: svn://tug.org/texlive/trunk@53963 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/tex/generic/babel/babel.def | 91 +++++++++++++++++++++++++--
 1 file changed, 87 insertions(+), 4 deletions(-)

(limited to 'Master/texmf-dist/tex/generic/babel/babel.def')

diff --git a/Master/texmf-dist/tex/generic/babel/babel.def b/Master/texmf-dist/tex/generic/babel/babel.def
index 1414affbc28..8fe5b53db95 100644
--- a/Master/texmf-dist/tex/generic/babel/babel.def
+++ b/Master/texmf-dist/tex/generic/babel/babel.def
@@ -41,7 +41,7 @@
     \wlog{File: #1 #4 #3 <#2>}%
     \let\ProvidesFile\@undefined}
 \fi
-\ProvidesFile{babel.def}[2020/02/14 3.40 Babel common definitions]
+\ProvidesFile{babel.def}[2020/02/28 3.41 Babel common definitions]
 \ifx\AtBeginDocument\@undefined
   \input plain.def\relax
 \fi
@@ -1392,7 +1392,8 @@
   \let\bbl@KVP@intraspace\@nil
   \let\bbl@KVP@intrapenalty\@nil
   \let\bbl@KVP@onchar\@nil
-  \let\bbl@KVP@chargroups\@nil
+  \let\bbl@KVP@alph\@nil
+  \let\bbl@KVP@Alph\@nil
   \bbl@forkv{#1}{%  TODO - error handling
     \in@{/}{##1}%
     \ifin@
@@ -1437,7 +1438,7 @@
   \bbl@ifunset{bbl@lname@#2}%
     {\def\BabelBeforeIni##1##2{%
        \begingroup
-         \catcode`\[=12 \catcode`\]=12 \catcode`\==12 %
+         \catcode`\[=12 \catcode`\]=12 \catcode`\==12  \catcode`\;=12 %
          \let\bbl@ini@captions@aux\@gobbletwo
          \def\bbl@inidate ####1.####2.####3.####4\relax ####5####6{}%
          \bbl@read@ini{##1}{basic data}%
@@ -1615,6 +1616,32 @@
         }}%
     \fi
   \fi
+  % == alph, Alph ==
+  % What if extras<lang> contains a \babel@save\@alph? It won't be
+  % restored correctly when exiting the language, so we ignore
+  % this change with the \bbl@alph@saved trick.
+  \ifx\bbl@KVP@alph\@nil\else
+    \toks@\expandafter\expandafter\expandafter{%
+      \csname extras\languagename\endcsname}%
+    \bbl@exp{%
+      \def\<extras\languagename>{%
+        \let\\\bbl@alph@saved\\\@alph
+        \the\toks@
+        \let\\\@alph\\\bbl@alph@saved
+        \\\babel@save\\\@alph
+        \let\\\@alph\<bbl@cntr@\bbl@KVP@alph @\languagename>}}%
+  \fi
+  \ifx\bbl@KVP@Alph\@nil\else
+    \toks@\expandafter\expandafter\expandafter{%
+      \csname extras\languagename\endcsname}%
+    \bbl@exp{%
+      \def\<extras\languagename>{%
+        \let\\\bbl@Alph@saved\\\@Alph
+        \the\toks@
+        \let\\\@Alph\\\bbl@Alph@saved
+        \\\babel@save\\\@Alph
+        \let\\\@Alph\<bbl@cntr@\bbl@KVP@Alph @\languagename>}}%
+  \fi
   % == require.babel in ini ==
   % To load or reaload the babel-*.tex, if require.babel in ini
   \bbl@ifunset{bbl@rqtex@\languagename}{}%
@@ -1855,6 +1882,24 @@
 \let\bbl@inikv@typography\bbl@inikv
 \let\bbl@inikv@characters\bbl@inikv
 \let\bbl@inikv@numbers\bbl@inikv
+\def\bbl@inikv@counters#1=#2\@@{%
+  \def\bbl@tempc{#1}%
+  \bbl@trim@def{\bbl@tempb*}{#2}%
+  \in@{.1$}{#1$}%
+  \ifin@
+    \bbl@replace\bbl@tempc{.1}{}%
+    \bbl@csarg\xdef{cntr@\bbl@tempc @\languagename}{%
+      \noexpand\bbl@alphnumeral{\bbl@tempc}}%
+  \fi
+  \in@{.F.}{#1}%
+  \ifin@\else\in@{.S.}{#1}\fi
+  \ifin@
+    \bbl@csarg\xdef{cntr@#1@\languagename}{\bbl@tempb*}%
+  \else
+    \toks@{}% Required by \bbl@buildifcase, which returns \bbl@tempa
+    \expandafter\bbl@buildifcase\bbl@tempb* \\ % Space after \\
+    \bbl@csarg{\global\expandafter\let}{cntr@#1@\languagename}\bbl@tempa
+  \fi}
 \def\bbl@after@ini{%
   \bbl@exportkey{lfthm}{typography.lefthyphenmin}{2}%
   \bbl@exportkey{rgthm}{typography.righthyphenmin}{3}%
@@ -1974,11 +2019,48 @@
   \def\BabelBeforeIni##1##2{%
     \begingroup
       \bbl@add\bbl@secpost@identification{\closein\bbl@readstream }%
-      \catcode`\[=12 \catcode`\]=12 \catcode`\==12 %
+      \catcode`\[=12 \catcode`\]=12 \catcode`\==12 \catcode`\;=12 %
       \bbl@read@ini{##1}{font and identification data}%
       \endinput          % babel- .tex may contain onlypreamble's
     \endgroup}%            boxed, to avoid extra spaces:
   {\setbox\z@\hbox{\InputIfFileExists{babel-#1.tex}{}{}}}}
+\def\bbl@buildifcase#1 {% Returns \bbl@tempa, requires \toks@={}
+  \ifx\\#1%             % \\ before, in case #1 is multiletter
+    \bbl@exp{%
+      \def\\\bbl@tempa####1{%
+        \<ifcase>####1\space\the\toks@\<else>\\\@ctrerr\<fi>}}%
+  \else
+    \toks@\expandafter{\the\toks@\or #1}%
+    \expandafter\bbl@buildifcase
+  \fi}
+\newcommand\localenumeral[2]{\@nameuse{bbl@cntr@#1@\languagename}{#2}}
+\def\bbl@localecntr#1#2{\localenumeral{#2}{#1}}
+\newcommand\localecounter[2]{%
+  \expandafter\bbl@localecntr\csname c@#2\endcsname{#1}}
+\def\bbl@alphnumeral#1#2{%
+  \expandafter\bbl@alphnumeral@i\number#2 76543210\@@{#1}}
+\def\bbl@alphnumeral@i#1#2#3#4#5#6#7#8\@@#9{%
+  \ifcase\@car#8\@nil\or   % Currenty <10000, but prepared for bigger
+    \bbl@alphnumeral@ii{#9}000000#1\or
+    \bbl@alphnumeral@ii{#9}00000#1#2\or
+    \bbl@alphnumeral@ii{#9}0000#1#2#3\or
+    \bbl@alphnumeral@ii{#9}000#1#2#3#4\else
+    \bbl@alphnum@invalid{>9999}%
+  \fi}
+\def\bbl@alphnumeral@ii#1#2#3#4#5#6#7#8{%
+  \bbl@ifunset{bbl@cntr@#1.F.\number#5#6#7#8@\languagename}%
+    {\@nameuse{bbl@cntr@#1.4@\languagename}#5%
+     \@nameuse{bbl@cntr@#1.3@\languagename}#6%
+     \@nameuse{bbl@cntr@#1.2@\languagename}#7%
+     \@nameuse{bbl@cntr@#1.1@\languagename}#8%
+     \ifnum#6#7#8>\z@ % An ad hod rule for Greek. Ugly. To be fixed.
+       \bbl@ifunset{bbl@cntr@#1.S.321@\languagename}{}%
+         {\@nameuse{bbl@cntr@#1.S.321@\languagename}}%
+     \fi}%
+    {\@nameuse{bbl@cntr@#1.F.\number#5#6#7#8@\languagename}}}
+\def\bbl@alphnum@invalid#1{%
+  \bbl@error{Alphabetic numeral too large (#1)}%
+    {Currently this is the limit.}}
 \newcommand\localeinfo[1]{%
   \bbl@ifunset{bbl@\csname bbl@info@#1\endcsname @\languagename}%
     {\bbl@error{I've found no info for the current locale.\\%
@@ -2304,6 +2386,7 @@
        \else
          \def\@elt#1{,#1,}%
          \edef\bbl@tempa{\expandafter\@gobbletwo\@fontenc@load@list}%
+         \let\@elt\relax
          \bbl@xin@{,T1,}\bbl@tempa
          \ifin@
            \xdef\latinencoding{\bbl@t@one}%
-- 
cgit v1.2.3

