From 5fbdfcab78ba7e1bbb32f4e9b1db06f68d6f3de4 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Tue, 27 Oct 2020 20:53:05 +0000
Subject: babel (27oct20)

git-svn-id: svn://tug.org/texlive/trunk@56784 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/tex/generic/babel/babel.def | 130 ++++++++++++++++++++------
 1 file changed, 101 insertions(+), 29 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 f3747e9539a..5b22adf11eb 100644
--- a/Master/texmf-dist/tex/generic/babel/babel.def
+++ b/Master/texmf-dist/tex/generic/babel/babel.def
@@ -39,7 +39,7 @@
     \wlog{File: #1 #4 #3 <#2>}%
     \let\ProvidesFile\@undefined}
 \fi
-\ProvidesFile{babel.def}[2020/10/06 3.50 Babel common definitions]
+\ProvidesFile{babel.def}[2020/10/27 3.51 Babel common definitions]
 \ifx\AtBeginDocument\@undefined  % TODO. change test.
     % == Code for plain ==
 \def\@empty{}
@@ -397,8 +397,8 @@
 \fi
 \countdef\last@language=19  % TODO. why? remove?
 \def\addlanguage{\csname newlanguage\endcsname}
-\def\bbl@version{3.50}
-\def\bbl@date{2020/10/06}
+\def\bbl@version{3.51}
+\def\bbl@date{2020/10/27}
 \def\adddialect#1#2{%
   \global\chardef#1#2\relax
   \bbl@usehooks{adddialect}{{#1}{#2}}%
@@ -470,7 +470,6 @@
       \IfFileExists{babel-\bbl@tempa.ini}{\let\bbl@bcp\bbl@tempa}{}%
     \fi
   \fi\fi}
-\let\bbl@autoload@options\@empty
 \let\bbl@initoload\relax
 \def\bbl@provide@locale{%
   \ifx\babelprovide\@undefined
@@ -673,8 +672,15 @@
     \fi
   \fi
   \global\let\bbl@hymapsel\@cclv
-  % hyphenation - patterns
+  % hyphenation - select patterns
   \bbl@patterns{#1}%
+  % hyphenation - allow stretching with babelnohyphens
+  \ifnum\language=\l@babelnohyphens
+    \babel@savevariable\emergencystretch
+    \emergencystretch\maxdimen
+    \babel@savevariable\hbadness
+    \hbadness\@M
+  \fi
   % hyphenation - mins
   \babel@savevariable\lefthyphenmin
   \babel@savevariable\righthyphenmin
@@ -779,7 +785,9 @@
   \bbl@fixname\bbl@tempf
   \bbl@iflanguage\bbl@tempf{%
     \expandafter\bbl@patterns\expandafter{\bbl@tempf}%
-    \languageshorthands{none}%
+    \ifx\languageshorthands\@undefined\else
+      \languageshorthands{none}%
+    \fi
     \expandafter\ifx\csname\bbl@tempf hyphenmins\endcsname\relax
       \set@hyphenmins\tw@\thr@@\relax
     \else
@@ -1441,6 +1449,14 @@
     \csname bbl@normal@\string#1\endcsname}
 \def\bbl@firstcs#1#2{\csname#1\endcsname}
 \def\bbl@scndcs#1#2{\csname#2\endcsname}
+
+\def\babel@texpdf#1#2#3#4{%
+  \ifx\texorpdfstring\@undefined
+    \textormath{#1}{#2}%
+  \else
+    \texorpdfstring{\textormath{#1}{#3}}{#2}%
+    % \texorpdfstring{\textormath{#1}{#3}}{\textormath{#2}{#4}}%
+  \fi}
 \def\declare@shorthand#1#2{\@decl@short{#1}#2\@nil}
 \def\@decl@short#1#2#3\@nil#4{%
   \def\bbl@tempa{#3}%
@@ -2009,6 +2025,55 @@
     \bbl@xin@{,}{\bbl@language@opts}%
     \chardef\bbl@opt@hyphenmap\ifin@4\else\@ne\fi
   \fi}
+\newcommand\setlocalecaption{%  TODO. Catch typos. What about ensure?
+  \@ifstar\bbl@setcaption@s\bbl@setcaption@x}
+\def\bbl@setcaption@x#1#2#3{%  language caption-name string
+  \edef\bbl@tempa{#1}%
+  \edef\bbl@tempd{%
+    \expandafter\expandafter\expandafter
+    \strip@prefix\expandafter\meaning\csname captions#1\endcsname}%
+  \bbl@xin@
+    {\expandafter\string\csname #2name\endcsname}%
+    {\bbl@tempd}%
+  \ifin@ % Renew caption
+    \bbl@xin@{\string\bbl@scset}{\bbl@tempd}%
+    \ifin@
+      \bbl@exp{%
+        \\\bbl@ifsamestring{\bbl@tempa}{\languagename}%
+          {\\\bbl@scset\<#2name>\<#1#2name>}%
+          {}}%
+    \else % Old way converts to new way
+      \bbl@ifunset{#1#2name}%
+        {\bbl@exp{%
+          \\\bbl@add\<captions#1>{\def\<#2name>{\<#1#2name>}}%
+          \\\bbl@ifsamestring{\bbl@tempa}{\languagename}%
+            {\def\<#2name>{\<#1#2name>}}%
+            {}}}%
+        {}%
+    \fi
+  \else
+    \bbl@xin@{\string\bbl@scset}{\bbl@tempd}% New
+    \ifin@ % New way
+      \bbl@exp{%
+        \\\bbl@add\<captions#1>{\\\bbl@scset\<#2name>\<#1#2name>}%
+        \\\bbl@ifsamestring{\bbl@tempa}{\languagename}%
+          {\\\bbl@scset\<#2name>\<#1#2name>}%
+          {}}%
+    \else  % Old way, but defined in the new way
+      \bbl@exp{%
+        \\\bbl@add\<captions#1>{\def\<#2name>{\<#1#2name>}}%
+        \\\bbl@ifsamestring{\bbl@tempa}{\languagename}%
+          {\def\<#2name>{\<#1#2name>}}%
+          {}}%
+    \fi%
+  \fi
+  \@namedef{#1#2name}{#3}%
+  \toks@\expandafter{\bbl@captionslist}%
+  \bbl@exp{\\\in@{\<#2name>}{\the\toks@}}%
+  \ifin@\else
+    \bbl@exp{\\\bbl@add\\\bbl@captionslist{\<#2name>}}%
+    \bbl@toglobal\bbl@captionslist
+  \fi}
 \bbl@trace{Macros related to glyphs}
 \def\set@low@box#1{\setbox\tw@\hbox{,}\setbox\z@\hbox{#1}%
     \dimen\z@\ht\z@ \advance\dimen\z@ -\ht\tw@%
@@ -2395,13 +2460,13 @@
     \fi
     \bbl@exp{\\\bbl@add\\\bbl@mapselect{\\\bbl@mapdir{\languagename}}}%
   \fi
-  % == intraspace, intrapenalty ==
+  % == Line breaking: intraspace, intrapenalty ==
   % For CJK, East Asian, Southeast Asian, if interspace in ini
   \ifx\bbl@KVP@intraspace\@nil\else % We can override the ini or set
     \bbl@csarg\edef{intsp@#2}{\bbl@KVP@intraspace}%
   \fi
   \bbl@provide@intraspace
-  % == hyphenate.other.locale ==
+  % == Line breaking: hyphenate.other.locale ==
   \bbl@ifunset{bbl@hyotl@\languagename}{}%
     {\bbl@csarg\bbl@replace{hyotl@\languagename}{ }{,}%
      \bbl@startcommands*{\languagename}{}%
@@ -2414,7 +2479,7 @@
            \SetHyphenMap{\BabelLower{##1}{##1}}%
          \fi}%
      \bbl@endcommands}%
-  % == hyphenate.other.script ==
+  % == Line breaking: hyphenate.other.script ==
   \bbl@ifunset{bbl@hyots@\languagename}{}%
     {\bbl@csarg\bbl@replace{hyots@\languagename}{ }{,}%
      \bbl@csarg\bbl@foreach{hyots@\languagename}{%
@@ -2425,7 +2490,7 @@
        \else
          \global\lccode##1=##1\relax
        \fi}}%
-  % == maparabic ==
+  % == Counters: maparabic ==
   % Native digits, if provided in ini (TeX level, xe and lua)
   \ifcase\bbl@engine\else
     \bbl@ifunset{bbl@dgnat@\languagename}{}%
@@ -2443,7 +2508,7 @@
         \fi
       \fi}%
   \fi
-  % == mapdigits ==
+  % == Counters: mapdigits ==
   % Native digits (lua level).
   \ifodd\bbl@engine
     \ifx\bbl@KVP@mapdigits\@nil\else
@@ -2480,7 +2545,7 @@
         }}%
     \fi
   \fi
-  % == alph, Alph ==
+  % == Counters: 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.
@@ -2508,15 +2573,17 @@
   \fi
   % == require.babel in ini ==
   % To load or reaload the babel-*.tex, if require.babel in ini
-  \bbl@ifunset{bbl@rqtex@\languagename}{}%
-    {\expandafter\ifx\csname bbl@rqtex@\languagename\endcsname\@empty\else
-       \let\BabelBeforeIni\@gobbletwo
-       \chardef\atcatcode=\catcode`\@
-       \catcode`\@=11\relax
-       \bbl@input@texini{\bbl@cs{rqtex@\languagename}}%
-       \catcode`\@=\atcatcode
-       \let\atcatcode\relax
-     \fi}%
+  \ifx\bbl@beforestart\relax\else  % But not in doc aux or body
+    \bbl@ifunset{bbl@rqtex@\languagename}{}%
+      {\expandafter\ifx\csname bbl@rqtex@\languagename\endcsname\@empty\else
+         \let\BabelBeforeIni\@gobbletwo
+         \chardef\atcatcode=\catcode`\@
+         \catcode`\@=11\relax
+         \bbl@input@texini{\bbl@cs{rqtex@\languagename}}%
+         \catcode`\@=\atcatcode
+         \let\atcatcode\relax
+       \fi}%
+  \fi
   % == main ==
   \ifx\bbl@KVP@main\@nil  % Restore only if not 'main'
     \let\languagename\bbl@savelangname
@@ -2682,9 +2749,13 @@
 \def\bbl@input@texini#1{%
   \bbl@bsphack
     \bbl@exp{%
-      \catcode`\\\%=14
+      \catcode`\\\%=14 \catcode`\\\\=0
+      \catcode`\\\{=1  \catcode`\\\}=2
       \lowercase{\\\InputIfFileExists{babel-#1.tex}{}{}}%
-      \catcode`\\\%=\the\catcode`\%\relax}%
+      \catcode`\\\%=\the\catcode`\%\relax
+      \catcode`\\\\=\the\catcode`\\\relax
+      \catcode`\\\{=\the\catcode`\{\relax
+      \catcode`\\\}=\the\catcode`\}\relax}%
   \bbl@esphack}
 \def\bbl@inipreread#1=#2\@@{%
   \bbl@trim@def\bbl@tempa{#1}% Redundant below !!
@@ -2708,7 +2779,7 @@
        is not complete.}%
       {Fix the name or reinstall babel.}%
   \else
-    \catcode`\[=12 \catcode`\]=12 \catcode`\==12
+    \catcode`\[=12 \catcode`\]=12 \catcode`\==12 \catcode`\&=12
     \catcode`\;=12 \catcode`\|=12 \catcode`\%=14
     \bbl@info{Importing
                 \ifcase#2 \or font and identification \or basic \fi
@@ -2725,7 +2796,7 @@
     \repeat
   \fi}
 \def\bbl@read@ini#1#2{%
-  \bbl@csarg\edef{lini@\languagename}{#1}%
+  \bbl@csarg\xdef{lini@\languagename}{#1}%
   \let\bbl@section\@empty
   \let\bbl@savestrings\@empty
   \let\bbl@savetoday\@empty
@@ -2824,7 +2895,8 @@
   \bbl@exportkey{elname}{identification.name.english}{}%
   \bbl@exp{\\\bbl@exportkey{lname}{identification.name.opentype}%
     {\csname bbl@elname@\languagename\endcsname}}%
-  \bbl@exportkey{lbcp}{identification.tag.bcp47}{}% TODO
+  \bbl@exportkey{tbcp}{identification.tag.bcp47}{}%
+  \bbl@exportkey{lbcp}{identification.language.tag.bcp47}{}%
   \bbl@exportkey{lotf}{identification.tag.opentype}{dflt}%
   \bbl@exportkey{esname}{identification.script.name}{}%
   \bbl@exp{\\\bbl@exportkey{sname}{identification.script.name.opentype}%
@@ -2832,7 +2904,7 @@
   \bbl@exportkey{sbcp}{identification.script.tag.bcp47}{}%
   \bbl@exportkey{sotf}{identification.script.tag.opentype}{DFLT}%
   \ifbbl@bcptoname
-    \bbl@csarg\xdef{bcp@map@\bbl@cl{lbcp}}{\languagename}%
+    \bbl@csarg\xdef{bcp@map@\bbl@cl{tbcp}}{\languagename}%
   \fi}
 \let\bbl@inikv@typography\bbl@inikv
 \let\bbl@inikv@characters\bbl@inikv
@@ -3247,7 +3319,8 @@
 \@namedef{bbl@info@tag.ini}{lini}
 \@namedef{bbl@info@name.english}{elname}
 \@namedef{bbl@info@name.opentype}{lname}
-\@namedef{bbl@info@tag.bcp47}{lbcp} % TODO
+\@namedef{bbl@info@tag.bcp47}{tbcp}
+\@namedef{bbl@info@language.tag.bcp47}{lbcp}
 \@namedef{bbl@info@tag.opentype}{lotf}
 \@namedef{bbl@info@script.name}{esname}
 \@namedef{bbl@info@script.name.opentype}{sname}
@@ -3361,7 +3434,6 @@
     \input luababel.def
   \fi
 \fi
-
 \endinput
 %%
 %% End of file `babel.def'.
-- 
cgit v1.2.3

