From de9dc4bb86a87f4d72b59034b56593313b2e8c8a Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Mon, 1 Apr 2019 21:10:44 +0000
Subject: babel (1apr19)

git-svn-id: svn://tug.org/texlive/trunk@50699 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/tex/generic/babel/babel.def | 81 ++++++++++++++++++---------
 1 file changed, 54 insertions(+), 27 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 5d2db7261f2..accbb739ae7 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}[2018/11/13 3.27 Babel common definitions]
+\ProvidesFile{babel.def}[2019/04/01 3.28 Babel common definitions]
 \ifx\AtBeginDocument\@undefined
   \input plain.def\relax
 \fi
@@ -1334,9 +1334,8 @@
     {\bbl@ifblank{#1}%
       {\bbl@error
         {If you want to modify `#2' you must tell how in\\%
-         the optional argument. Currently there are three\\%
-         options: captions=lang-tag, hyphenrules=lang-list\\%
-         import=lang-tag}%
+         the optional argument. See the manual for the\\%
+         available options.}%
         {Use this macro as documented}}%
       {\bbl@provide@renew{#2}}}%
   % Post tasks
@@ -1599,9 +1598,9 @@
   \@nameuse{bbl@secpost@\bbl@section}%  ends previous section
   \def\bbl@section{#1}%
   \@nameuse{bbl@secpre@\bbl@section}%   starts current section
-  \bbl@ifunset{bbl@secline@#1}%
+  \bbl@ifunset{bbl@inikv@#1}%
     {\let\bbl@inireader\bbl@iniskip}%
-    {\bbl@exp{\let\\\bbl@inireader\<bbl@secline@#1>}}}
+    {\bbl@exp{\let\\\bbl@inireader\<bbl@inikv@#1>}}}
 \def\bbl@inikv#1=#2\@@{%     key=value
   \bbl@trim@def\bbl@tempa{#1}%
   \bbl@trim\toks@{#2}%
@@ -1614,7 +1613,7 @@
      \else
        \bbl@exp{\global\let\<bbl@#1@\languagename>\<bbl@@kv@#2>}%
      \fi}}
-\let\bbl@secline@identification\bbl@inikv
+\let\bbl@inikv@identification\bbl@inikv
 \def\bbl@secpost@identification{%
   \bbl@exportkey{lname}{identification.name.english}{}%
   \bbl@exportkey{lbcp}{identification.tag.bcp47}{}%
@@ -1622,9 +1621,9 @@
   \bbl@exportkey{sname}{identification.script.name}{}%
   \bbl@exportkey{sbcp}{identification.script.tag.bcp47}{}%
   \bbl@exportkey{sotf}{identification.script.tag.opentype}{DFLT}}
-\let\bbl@secline@typography\bbl@inikv
-\let\bbl@secline@characters\bbl@inikv
-\let\bbl@secline@numbers\bbl@inikv
+\let\bbl@inikv@typography\bbl@inikv
+\let\bbl@inikv@characters\bbl@inikv
+\let\bbl@inikv@numbers\bbl@inikv
 \def\bbl@after@ini{%
   \bbl@exportkey{lfthm}{typography.lefthyphenmin}{2}%
   \bbl@exportkey{rgthm}{typography.righthyphenmin}{3}%
@@ -1651,17 +1650,11 @@
   \bbl@toglobal\bbl@savetoday
   \bbl@toglobal\bbl@savedate}
 \ifcase\bbl@engine
-  \bbl@csarg\def{secline@captions.licr}#1=#2\@@{%
+  \bbl@csarg\def{inikv@captions.licr}#1=#2\@@{%
     \bbl@ini@captions@aux{#1}{#2}}
-  \bbl@csarg\def{secline@date.gregorian}#1=#2\@@{%       for defaults
-    \bbl@ini@dategreg#1...\relax{#2}}
-  \bbl@csarg\def{secline@date.gregorian.licr}#1=#2\@@{%  override
-    \bbl@ini@dategreg#1...\relax{#2}}
 \else
-  \def\bbl@secline@captions#1=#2\@@{%
+  \def\bbl@inikv@captions#1=#2\@@{%
     \bbl@ini@captions@aux{#1}{#2}}
-  \bbl@csarg\def{secline@date.gregorian}#1=#2\@@{%
-    \bbl@ini@dategreg#1...\relax{#2}}
 \fi
 \def\bbl@ini@captions@aux#1#2{%
   \bbl@trim@def\bbl@tempa{#1}%
@@ -1672,17 +1665,31 @@
   \bbl@exp{%
     \\\bbl@add\\\bbl@savestrings{%
       \\\SetString\<\bbl@tempa name>{\the\toks@}}}}
-\bbl@csarg\def{secpre@date.gregorian.licr}{%
-  \ifcase\bbl@engine\let\bbl@savedate\@empty\fi}
-\def\bbl@ini@dategreg#1.#2.#3.#4\relax#5{% TODO - ignore with 'captions'
+\bbl@csarg\def{inikv@date.gregorian}#1=#2\@@{%       for defaults
+  \bbl@inidate#1...\relax{#2}{}}
+\bbl@csarg\def{inikv@date.islamic}#1=#2\@@{%
+  \bbl@inidate#1...\relax{#2}{islamic}}
+\bbl@csarg\def{inikv@date.hebrew}#1=#2\@@{%
+  \bbl@inidate#1...\relax{#2}{hebrew}}
+\bbl@csarg\def{inikv@date.persian}#1=#2\@@{%
+  \bbl@inidate#1...\relax{#2}{persian}}
+\bbl@csarg\def{inikv@date.indian}#1=#2\@@{%
+  \bbl@inidate#1...\relax{#2}{indian}}
+\ifcase\bbl@engine
+  \bbl@csarg\def{inikv@date.gregorian.licr}#1=#2\@@{%  override
+    \bbl@inidate#1...\relax{#2}{}}
+  \bbl@csarg\def{secpre@date.gregorian.licr}{%           discard uni
+    \ifcase\bbl@engine\let\bbl@savedate\@empty\fi}
+\fi
+\def\bbl@inidate#1.#2.#3.#4\relax#5#6{% TODO - ignore with 'captions'
   \bbl@trim@def\bbl@tempa{#1.#2}%
-  \bbl@ifsamestring{\bbl@tempa}{months.wide}%
+  \bbl@ifsamestring{\bbl@tempa}{months.wide}%      to savedate
     {\bbl@trim@def\bbl@tempa{#3}%
      \bbl@trim\toks@{#5}%
      \bbl@exp{%
       \\\bbl@add\\\bbl@savedate{%
-        \\\SetString\<month\romannumeral\bbl@tempa name>{\the\toks@}}}}%
-    {\bbl@ifsamestring{\bbl@tempa}{date.long}%
+        \\\SetString\<month\romannumeral\bbl@tempa#6name>{\the\toks@}}}}%
+    {\bbl@ifsamestring{\bbl@tempa}{date.long}%     defined now
       {\bbl@trim@def\bbl@toreplace{#5}%
        \bbl@TG@@date
        \global\bbl@csarg\let{date@\languagename}\bbl@toreplace
@@ -1696,6 +1703,7 @@
            \\\SetString\\\today{%
              \<\languagename date>{\\\the\year}{\\\the\month}{\\\the\day}}}}}}%
       {}}
+\let\bbl@calendar\@empty
 \newcommand\BabelDateSpace{\nobreakspace}
 \newcommand\BabelDateDot{.\@}
 \newcommand\BabelDated[1]{{\number#1}}
@@ -1703,7 +1711,7 @@
 \newcommand\BabelDateM[1]{{\number#1}}
 \newcommand\BabelDateMM[1]{{\ifnum#1<10 0\fi\number#1}}
 \newcommand\BabelDateMMMM[1]{{%
-  \csname month\romannumeral#1name\endcsname}}%
+  \csname month\romannumeral#1\bbl@calendar name\endcsname}}%
 \newcommand\BabelDatey[1]{{\number#1}}%
 \newcommand\BabelDateyy[1]{{%
   \ifnum#1<10 0\number#1 %
@@ -2035,6 +2043,7 @@
 \ifodd\bbl@engine  % luatex=1
   \AddBabelHook{babel-bidi}{afterextras}{\bbl@switchdir}
   \DisableBabelHook{babel-bidi}
+  \chardef\bbl@thetextdir\z@
   \chardef\bbl@thepardir\z@
   \def\bbl@getluadir#1{%
     \directlua{
@@ -2055,12 +2064,24 @@
     \fi}
   \def\bbl@textdir#1{%
     \bbl@setluadir{text}\textdir{#1}% TODO - ?\linedir
+    \chardef\bbl@thetextdir#1\relax
     \setattribute\bbl@attr@dir{\numexpr\bbl@thepardir*3+#1}}
-  \def\bbl@pardir#1{\bbl@setluadir{par}\pardir{#1}%
+  \def\bbl@pardir#1{%
+    \bbl@setluadir{par}\pardir{#1}%
     \chardef\bbl@thepardir#1\relax}
   \def\bbl@bodydir{\bbl@setluadir{body}\bodydir}
   \def\bbl@pagedir{\bbl@setluadir{page}\pagedir}
   \def\bbl@dirparastext{\pardir\the\textdir\relax}%   %%%%
+  % Sadly, we have to deal with boxes in math with basic:
+  \def\bbl@mathboxdir{%
+    \ifcase\bbl@thetextdir\relax
+      \everyhbox{\bgroup\aftergroup\egroup\textdir TLT\relax}%
+    \else
+      \everyhbox{\bgroup\aftergroup\egroup\textdir TRT\relax}%
+    \fi}
+  % TODO - the same trick as bbl@severypar
+  \everymath{\bbl@mathboxdir}
+  \everydisplay{\bbl@mathboxdir}
 \else % pdftex=0, xetex=2
   \AddBabelHook{babel-bidi}{afterextras}{\bbl@switchdir}
   \DisableBabelHook{babel-bidi}
@@ -2133,7 +2154,13 @@
      \def\bbl@pardir#1{\ifcase#1\relax\setLR\else\setRL\fi}}
     {}%
 \fi
-  \DeclareRobustCommand\babelsublr[1]{\leavevmode{\bbl@textdir\z@#1}}
+\DeclareRobustCommand\babelsublr[1]{\leavevmode{\bbl@textdir\z@#1}}
+\AtBeginDocument{%
+  \ifx\pdfstringdefDisableCommands\@undefined\else
+    \ifx\pdfstringdefDisableCommands\relax\else
+      \pdfstringdefDisableCommands{\let\babelsublr\@firstofone}%
+    \fi
+  \fi}
 \bbl@trace{Local Language Configuration}
 \ifx\loadlocalcfg\@undefined
   \@ifpackagewith{babel}{noconfigs}%
-- 
cgit v1.2.3

