diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/babel/babel.def')
-rw-r--r-- | Master/texmf-dist/tex/generic/babel/babel.def | 165 |
1 files changed, 116 insertions, 49 deletions
diff --git a/Master/texmf-dist/tex/generic/babel/babel.def b/Master/texmf-dist/tex/generic/babel/babel.def index e8b54aa88ba..4d016da281d 100644 --- a/Master/texmf-dist/tex/generic/babel/babel.def +++ b/Master/texmf-dist/tex/generic/babel/babel.def @@ -38,7 +38,7 @@ %% and covered by LPPL is defined by the unpacking scripts (with %% extension .ins) which are part of the distribution. %% File 'babel.dtx' -%%\ProvidesFile{babel.dtx}[2017/06/29 v3.12 The Babel package] +%%\ProvidesFile{babel.dtx}[2017/09/18 v3.13 The Babel package] %% Babel package for LaTeX2e. %% Copyright (C) 1989-2008 by Johannes Braams, %% TeXniek @@ -56,7 +56,7 @@ \wlog{File: #1 #4 #3 <#2>}% \let\ProvidesFile\@undefined} \fi -\ProvidesFile{babel.def}[2017/06/29 3.12 Babel common definitions] +\ProvidesFile{babel.def}[2017/09/18 3.13 Babel common definitions] \ifx\AtBeginDocument\@undefined \input plain.def\relax \fi @@ -1273,9 +1273,13 @@ \let\bbl@savelangname\languagename \def\languagename{#2}% \let\bbl@KVP@captions\@nil + \let\bbl@KVP@import\@nil \let\bbl@KVP@main\@nil \let\bbl@KVP@hyphenrules\@nil \bbl@forkv{#1}{\bbl@csarg\def{KVP@##1}{##2}}% TODO - error handling + \ifx\bbl@KVP@captions\@nil + \let\bbl@KVP@captions\bbl@KVP@import + \fi \bbl@ifunset{date#2}% {\bbl@provide@new{#2}}% {\bbl@ifblank{#1}% @@ -1285,7 +1289,7 @@ options: captions=lang-tag, hyphenrules=lang-list}% {Use this macro as documented}}% {\bbl@provide@renew{#2}}}% - \babelensure{#2}% + \bbl@exp{\\\babelensure[exclude=\\\today]{#2}}% \let\languagename\bbl@savelangname} \def\bbl@provide@new#1{% \bbl@provide@hyphens{#1}% @@ -1293,8 +1297,8 @@ \@namedef{extras#1}{}% \@namedef{noextras#1}{}% \StartBabelCommands*{#1}{captions}% - \ifx\bbl@KVP@captions\@nil - \def\bbl@tempb##1{% elt for \bbl@captionslist + \ifx\bbl@KVP@captions\@nil % and also if import, implicit + \def\bbl@tempb##1{% elt for \bbl@captionslist \ifx##1\@empty\else \bbl@exp{% \\\SetString\\##1{% @@ -1308,10 +1312,18 @@ \bbl@savestrings \fi \StartBabelCommands*{#1}{date}% - \bbl@exp{% - \\\SetString\\\today{\\\bbl@nocaption{today}{\<#1today>}}}% + \ifx\bbl@KVP@import\@nil + \bbl@exp{% + \\\SetString\\\today{\\\bbl@nocaption{today}{\<#1today>}}}% + \else + \bbl@savetoday + \bbl@savedate + \fi \EndBabelCommands - \expandafter\gdef\csname#1hyphenmins\endcsname{23}% + \bbl@exp{% + \def\<#1hyphenmins>{% + {\bbl@ifunset{bbl@lfthm@#1}{2}{\@nameuse{bbl@lfthm@#1}}}% + {\bbl@ifunset{bbl@rgthm@#1}{3}{\@nameuse{bbl@rgthm@#1}}}}}% \ifx\bbl@KVP@main\@nil\else \expandafter\main@language\expandafter{#1}% \fi} @@ -1323,6 +1335,12 @@ \bbl@after@ini \bbl@savestrings \EndBabelCommands + \fi + \ifx\bbl@KVP@import\@nil\else + \StartBabelCommands*{#1}{date}% + \bbl@savetoday + \bbl@savedate + \EndBabelCommands \fi} \def\bbl@provide@hyphens#1{% \let\bbl@tempa\relax @@ -1356,6 +1374,10 @@ \else \let\bbl@section\@empty \let\bbl@savestrings\@empty + \let\bbl@savetoday\@empty + \let\bbl@savedate\@empty + \let\bbl@inireader\bbl@iniskip + \bbl@info{Importing data from babel-#1.ini for \languagename}% \loop \endlinechar\m@ne \read1 to \bbl@line @@ -1367,54 +1389,92 @@ \repeat \fi} \def\bbl@iniline#1\bbl@iniline{% - \@ifnextchar[\bbl@inisec{\@ifnextchar;\bbl@iniskip\bbl@inikv}#1\@@} %] + \@ifnextchar[\bbl@inisec{\@ifnextchar;\bbl@iniskip\bbl@inireader}#1\@@}% ] \def\bbl@iniskip#1\@@{}% if starts with ; \def\bbl@inisec[#1]#2\@@{% if starts with opening bracket + \@nameuse{bbl@secpost@\bbl@section}% ends previous section \def\bbl@section{#1}% - \bbl@debug{\message{[[ #1 ]]^^J}}} -\def\bbl@inikv#1=#2\@@{% otherwise, key=value + \@nameuse{bbl@secpre@\bbl@section}% starts current section + \bbl@ifunset{bbl@secline@#1}% + {\let\bbl@inireader\bbl@iniskip}% + {\bbl@exp{\let\\\bbl@inireader\<bbl@secline@#1>}}} +\def\bbl@inikv#1=#2\@@{% key=value \bbl@trim@def\bbl@tempa{#1}% \bbl@trim\toks@{#2}% - \bbl@ifunset{bbl@ini@\bbl@section}% - {}% - {\bbl@exp{% - \<bbl@ini@\bbl@section>\bbl@tempa=\the\toks@\\\@nil}}} + \bbl@csarg\edef{@kv@\bbl@section.\bbl@tempa}{\the\toks@}} +\def\bbl@exportkey#1#2#3{% + \bbl@ifunset{bbl@@kv@#2}% + {\bbl@csarg\gdef{#1@\languagename}{#3}}% + {\expandafter\ifx\csname bbl@@kv@#2\endcsname\@empty + \bbl@csarg\gdef{#1@\languagename}{#3}% + \else + \bbl@exp{\global\let\<bbl@#1@\languagename>\<bbl@@kv@#2>}% + \fi}} +\let\bbl@secline@identification\bbl@inikv +\def\bbl@secpost@identification{% + \bbl@exportkey{lname}{identification.name.english}{}% + \bbl@exportkey{lbcp}{identification.tag.bcp47}{}% + \bbl@exportkey{lotf}{identification.tag.opentype}{dflt}% + \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 \def\bbl@after@ini{% - % make sure Script and Language takes some value - \bbl@exp{\\\bbl@ifblank{\@nameuse{bbl@lotf@\languagename}}}% - {\bbl@csarg\gdef{lotf@\languagename}{dflt}}{}% - \bbl@exp{\\\bbl@ifblank{\@nameuse{bbl@sotf@\languagename}}}% - {\bbl@csarg\gdef{sotf@\languagename}{DFLT}}{}} -\def\bbl@exportkey#1#2#3#4{% 1:bbl id,2:ini name,3:ini key,4:ini val - \bbl@ifsamestring{#2}{#3}% - {\bbl@csarg\gdef{#1@\languagename}{#4}}% - {}} + \bbl@exportkey{lfthm}{typography.lefthyphenmin}{2}% + \bbl@exportkey{rgthm}{typography.righthyphenmin}{3}% + \def\bbl@tempa{0.9}% + \bbl@csarg\ifx{@kv@identification.version}\bbl@tempa + \bbl@warning{% + The `\languagename' date format may not be suitable\\% + for proper typesetting, and therefore it very likely will\\% + change in a future release. Reported}% + \fi + \bbl@toglobal\bbl@savetoday + \bbl@toglobal\bbl@savedate} \ifcase\bbl@engine - \bbl@csarg\def{ini@captions.licr}#1=#2\@nil{% TODO - copypaste pattern - \bbl@ifblank{#2}% - {\bbl@exp{% - \toks@{\\\bbl@nocaption{#1}\<\languagename#1name>}}}% - {\toks@{#2}}% - \bbl@exp{% - \\\bbl@add\\\bbl@savestrings{% NOTE - with date will be global - \\\SetString\<#1name>{\the\toks@}}}} + \bbl@csarg\def{secline@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@ini@captions#1=#2\@nil{% - \bbl@ifblank{#2}% - {\bbl@exp{% - \toks@{\\\bbl@nocaption{#1}\<\languagename#1name>}}}% - {\toks@{#2}}% - \bbl@exp{% - \\\bbl@add\\\bbl@savestrings{% - \\\SetString\<#1name>{\the\toks@}}}} + \def\bbl@secline@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@identification#1=#2\@nil{% TODO - not only with captions - \bbl@exportkey{lname}{name.english}{#1}{#2}% - \bbl@exportkey{lbcp}{tag.bcp47}{#1}{#2}% - \bbl@exportkey{lotf}{tag.opentype}{#1}{#2}% - \bbl@exportkey{sname}{script.name}{#1}{#2}% - \bbl@exportkey{sbcp}{script.tag.bcp47}{#1}{#2}% - \bbl@exportkey{sotf}{script.tag.opentype}{#1}{#2}} +\def\bbl@ini@captions@aux#1#2{% + \bbl@trim@def\bbl@tempa{#1}% + \bbl@ifblank{#2}% + {\bbl@exp{% + \toks@{\\\bbl@nocaption{\bbl@tempa}\<\languagename\bbl@tempa name>}}}% + {\bbl@trim\toks@{#2}}% + \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@trim@def\bbl@tempa{#1.#2}% + \bbl@ifsamestring{\bbl@tempa}{months.wide}% + {\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}% + {\bbl@trim@def\bbl@toreplace{#5}% + \bbl@TG@@date + \global\bbl@csarg\let{date@\languagename}\bbl@toreplace + \bbl@exp{% + \gdef\<\languagename date>####1####2####3{% + \<bbl@ensure@\languagename>{% + \<bbl@date@\languagename>{####1}{####2}{####3}}}% + \\\bbl@add\\\bbl@savetoday{% + \\\SetString\\\today{% + \<\languagename date>{\year}{\month}{\day}}}}}}% + {}} \newcommand\BabelDateSpace{\nobreakspace{}} \newcommand\BabelDateDot{.\@} \newcommand\BabelDated[1]{{\number#1}} @@ -1429,9 +1489,15 @@ \else\ifnum#1<100 \number#1 % \else\ifnum#1<1000 \expandafter\@gobble\number#1 % \else\ifnum#1<10000 \expandafter\@gobbletwo\number#1 % - \else\ERRORd % TODO - real error + \else + \bbl@error + {Currently two-digit years are restricted to the\\ + range 0-9999.}% + {There is little you can do. Sorry.}% \fi\fi\fi\fi}} \newcommand\BabelDateyyyy[1]{{\number#1}} +\def\bbl@replace@finish@iii#1{% + \bbl@exp{\def\\#1####1####2####3{\the\toks@}}} \def\bbl@TG@@date{% \bbl@replace\bbl@toreplace{[ ]}{\BabelDateSpace{}}% \bbl@replace\bbl@toreplace{[.]}{\BabelDateDot{}}% @@ -1442,7 +1508,8 @@ \bbl@replace\bbl@toreplace{[MMMM]}{\BabelDateMMMM{####2}}% \bbl@replace\bbl@toreplace{[y]}{\BabelDatey{####1}}% \bbl@replace\bbl@toreplace{[yy]}{\BabelDateyy{####1}}% - \bbl@replace\bbl@toreplace{[yyyy]}{\BabelDateyyyy{####1}}} + \bbl@replace\bbl@toreplace{[yyyy]}{\BabelDateyyyy{####1}}% + \bbl@replace@finish@iii\bbl@toreplace} \ifx\bbl@opt@safe\@empty\else \def\@newl@bel#1#2#3{% {\@safe@activestrue |