diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/babel/babel.sty')
-rw-r--r-- | Master/texmf-dist/tex/generic/babel/babel.sty | 258 |
1 files changed, 38 insertions, 220 deletions
diff --git a/Master/texmf-dist/tex/generic/babel/babel.sty b/Master/texmf-dist/tex/generic/babel/babel.sty index 4ed44235120..eab6b9801f0 100644 --- a/Master/texmf-dist/tex/generic/babel/babel.sty +++ b/Master/texmf-dist/tex/generic/babel/babel.sty @@ -34,7 +34,7 @@ %% \NeedsTeXFormat{LaTeX2e}[2005/12/01] -\ProvidesPackage{babel}[2023/04/18 3.88 The Babel package] +\ProvidesPackage{babel}[2023/05/11 v3.89 The Babel package] \@ifpackagewith{babel}{debug} {\providecommand\bbl@trace[1]{\message{^^J[ #1 ]}}% \let\bbl@debug\@firstofone @@ -305,6 +305,8 @@ \bbl@csarg\let{tempa\expandafter}\csname opt@babel.sty\endcsname \def\bbl@tempb#1.#2{% Remove trailing dot #1\ifx\@empty#2\else,\bbl@afterfi\bbl@tempb#2\fi}% +\def\bbl@tempe#1=#2\@@{% + \bbl@csarg\edef{mod@#1}{\bbl@tempb#2}} \def\bbl@tempd#1.#2\@nnil{% TODO. Refactor lists? \ifx\@empty#2% \edef\bbl@tempc{\ifx\bbl@tempc\@empty\else\bbl@tempc,\fi#1}% @@ -314,12 +316,17 @@ \edef\bbl@tempc{% \ifx\bbl@tempc\@empty\else\bbl@tempc,\fi#1.\bbl@tempb#2}% \else - \in@{=}{#1}% + \in@{$modifiers$}{$#1$}% TODO. Allow spaces. \ifin@ - \edef\bbl@tempc{\ifx\bbl@tempc\@empty\else\bbl@tempc,\fi#1.#2}% + \bbl@tempe#2\@@ \else - \edef\bbl@tempc{\ifx\bbl@tempc\@empty\else\bbl@tempc,\fi#1}% - \bbl@csarg\edef{mod@#1}{\bbl@tempb#2}% + \in@{=}{#1}% + \ifin@ + \edef\bbl@tempc{\ifx\bbl@tempc\@empty\else\bbl@tempc,\fi#1.#2}% + \else + \edef\bbl@tempc{\ifx\bbl@tempc\@empty\else\bbl@tempc,\fi#1}% + \bbl@csarg\edef{mod@#1}{\bbl@tempb#2}% + \fi \fi \fi \fi} @@ -463,8 +470,8 @@ \expandafter\@secondoftwo \fi} \fi -\def\bbl@version{3.88} -\def\bbl@date{2023/04/18} +\def\bbl@version{3.89} +\def\bbl@date{2023/05/11} \ifx\language\@undefined \csname newcount\endcsname\language \fi @@ -712,8 +719,6 @@ % set the locale id \bbl@id@assign % switch captions, date - % No text is supposed to be added here, so we remove any - % spurious spaces. \bbl@bsphack \ifcase\bbl@select@type \csname captions#1\endcsname\relax @@ -784,6 +789,7 @@ \expandafter\expandafter\expandafter\set@hyphenmins \csname #1hyphenmins\endcsname\relax \fi + % reset selector name \let\bbl@selectorname\@empty} \long\def\otherlanguage#1{% \def\bbl@selectorname{other}% @@ -968,193 +974,6 @@ \input luababel.def \fi \fi -\bbl@trace{Basic macros} -\def\bbl@stripslash{\expandafter\@gobble\string} -\def\bbl@add#1#2{% - \bbl@ifunset{\bbl@stripslash#1}% - {\def#1{#2}}% - {\expandafter\def\expandafter#1\expandafter{#1#2}}} -\def\bbl@xin@{\@expandtwoargs\in@} -\def\bbl@carg#1#2{\expandafter#1\csname#2\endcsname}% -\def\bbl@ncarg#1#2#3{\expandafter#1\expandafter#2\csname#3\endcsname}% -\def\bbl@ccarg#1#2#3{% - \expandafter#1\csname#2\expandafter\endcsname\csname#3\endcsname}% -\def\bbl@csarg#1#2{\expandafter#1\csname bbl@#2\endcsname}% -\def\bbl@cs#1{\csname bbl@#1\endcsname} -\def\bbl@cl#1{\csname bbl@#1@\languagename\endcsname} -\def\bbl@loop#1#2#3{\bbl@@loop#1{#3}#2,\@nnil,} -\def\bbl@loopx#1#2{\expandafter\bbl@loop\expandafter#1\expandafter{#2}} -\def\bbl@@loop#1#2#3,{% - \ifx\@nnil#3\relax\else - \def#1{#3}#2\bbl@afterfi\bbl@@loop#1{#2}% - \fi} -\def\bbl@for#1#2#3{\bbl@loopx#1{#2}{\ifx#1\@empty\else#3\fi}} -\def\bbl@add@list#1#2{% - \edef#1{% - \bbl@ifunset{\bbl@stripslash#1}% - {}% - {\ifx#1\@empty\else#1,\fi}% - #2}} -\long\def\bbl@afterelse#1\else#2\fi{\fi#1} -\long\def\bbl@afterfi#1\fi{\fi#1} -\def\bbl@exp#1{% - \begingroup - \let\\\noexpand - \let\<\bbl@exp@en - \let\[\bbl@exp@ue - \edef\bbl@exp@aux{\endgroup#1}% - \bbl@exp@aux} -\def\bbl@exp@en#1>{\expandafter\noexpand\csname#1\endcsname}% -\def\bbl@exp@ue#1]{% - \unexpanded\expandafter\expandafter\expandafter{\csname#1\endcsname}}% -\def\bbl@tempa#1{% - \long\def\bbl@trim##1##2{% - \futurelet\bbl@trim@a\bbl@trim@c##2\@nil\@nil#1\@nil\relax{##1}}% - \def\bbl@trim@c{% - \ifx\bbl@trim@a\@sptoken - \expandafter\bbl@trim@b - \else - \expandafter\bbl@trim@b\expandafter#1% - \fi}% - \long\def\bbl@trim@b#1##1 \@nil{\bbl@trim@i##1}} -\bbl@tempa{ } -\long\def\bbl@trim@i#1\@nil#2\relax#3{#3{#1}} -\long\def\bbl@trim@def#1{\bbl@trim{\def#1}} -\begingroup - \gdef\bbl@ifunset#1{% - \expandafter\ifx\csname#1\endcsname\relax - \expandafter\@firstoftwo - \else - \expandafter\@secondoftwo - \fi} - \bbl@ifunset{ifcsname}% - {}% - {\gdef\bbl@ifunset#1{% - \ifcsname#1\endcsname - \expandafter\ifx\csname#1\endcsname\relax - \bbl@afterelse\expandafter\@firstoftwo - \else - \bbl@afterfi\expandafter\@secondoftwo - \fi - \else - \expandafter\@firstoftwo - \fi}} -\endgroup -\def\bbl@ifblank#1{% - \bbl@ifblank@i#1\@nil\@nil\@secondoftwo\@firstoftwo\@nil} -\long\def\bbl@ifblank@i#1#2\@nil#3#4#5\@nil{#4} -\def\bbl@ifset#1#2#3{% - \bbl@ifunset{#1}{#3}{\bbl@exp{\\\bbl@ifblank{\@nameuse{#1}}}{#3}{#2}}} -\def\bbl@forkv#1#2{% - \def\bbl@kvcmd##1##2##3{#2}% - \bbl@kvnext#1,\@nil,} -\def\bbl@kvnext#1,{% - \ifx\@nil#1\relax\else - \bbl@ifblank{#1}{}{\bbl@forkv@eq#1=\@empty=\@nil{#1}}% - \expandafter\bbl@kvnext - \fi} -\def\bbl@forkv@eq#1=#2=#3\@nil#4{% - \bbl@trim@def\bbl@forkv@a{#1}% - \bbl@trim{\expandafter\bbl@kvcmd\expandafter{\bbl@forkv@a}}{#2}{#4}} -\def\bbl@vforeach#1#2{% - \def\bbl@forcmd##1{#2}% - \bbl@fornext#1,\@nil,} -\def\bbl@fornext#1,{% - \ifx\@nil#1\relax\else - \bbl@ifblank{#1}{}{\bbl@trim\bbl@forcmd{#1}}% - \expandafter\bbl@fornext - \fi} -\def\bbl@foreach#1{\expandafter\bbl@vforeach\expandafter{#1}} -\def\bbl@replace#1#2#3{% in #1 -> repl #2 by #3 - \toks@{}% - \def\bbl@replace@aux##1#2##2#2{% - \ifx\bbl@nil##2% - \toks@\expandafter{\the\toks@##1}% - \else - \toks@\expandafter{\the\toks@##1#3}% - \bbl@afterfi - \bbl@replace@aux##2#2% - \fi}% - \expandafter\bbl@replace@aux#1#2\bbl@nil#2% - \edef#1{\the\toks@}} -\ifx\detokenize\@undefined\else % Unused macros if old Plain TeX - \bbl@exp{\def\\\bbl@parsedef##1\detokenize{macro:}}#2->#3\relax{% - \def\bbl@tempa{#1}% - \def\bbl@tempb{#2}% - \def\bbl@tempe{#3}} - \def\bbl@sreplace#1#2#3{% - \begingroup - \expandafter\bbl@parsedef\meaning#1\relax - \def\bbl@tempc{#2}% - \edef\bbl@tempc{\expandafter\strip@prefix\meaning\bbl@tempc}% - \def\bbl@tempd{#3}% - \edef\bbl@tempd{\expandafter\strip@prefix\meaning\bbl@tempd}% - \bbl@xin@{\bbl@tempc}{\bbl@tempe}% If not in macro, do nothing - \ifin@ - \bbl@exp{\\\bbl@replace\\\bbl@tempe{\bbl@tempc}{\bbl@tempd}}% - \def\bbl@tempc{% Expanded an executed below as 'uplevel' - \\\makeatletter % "internal" macros with @ are assumed - \\\scantokens{% - \bbl@tempa\\\@namedef{\bbl@stripslash#1}\bbl@tempb{\bbl@tempe}}% - \catcode64=\the\catcode64\relax}% Restore @ - \else - \let\bbl@tempc\@empty % Not \relax - \fi - \bbl@exp{% For the 'uplevel' assignments - \endgroup - \bbl@tempc}} % empty or expand to set #1 with changes -\fi -\def\bbl@ifsamestring#1#2{% - \begingroup - \protected@edef\bbl@tempb{#1}% - \edef\bbl@tempb{\expandafter\strip@prefix\meaning\bbl@tempb}% - \protected@edef\bbl@tempc{#2}% - \edef\bbl@tempc{\expandafter\strip@prefix\meaning\bbl@tempc}% - \ifx\bbl@tempb\bbl@tempc - \aftergroup\@firstoftwo - \else - \aftergroup\@secondoftwo - \fi - \endgroup} -\chardef\bbl@engine=% - \ifx\directlua\@undefined - \ifx\XeTeXinputencoding\@undefined - \z@ - \else - \tw@ - \fi - \else - \@ne - \fi -\def\bbl@bsphack{% - \ifhmode - \hskip\z@skip - \def\bbl@esphack{\loop\ifdim\lastskip>\z@\unskip\repeat\unskip}% - \else - \let\bbl@esphack\@empty - \fi} -\def\bbl@cased{% - \ifx\oe\OE - \expandafter\in@\expandafter - {\expandafter\OE\expandafter}\expandafter{\oe}% - \ifin@ - \bbl@afterelse\expandafter\MakeUppercase - \else - \bbl@afterfi\expandafter\MakeLowercase - \fi - \else - \expandafter\@firstofone - \fi} -\def\bbl@extras@wrap#1#2#3{% 1:in-test, 2:before, 3:after - \toks@\expandafter\expandafter\expandafter{% - \csname extras\languagename\endcsname}% - \bbl@exp{\\\in@{#1}{\the\toks@}}% - \ifin@\else - \@temptokena{#2}% - \edef\bbl@tempc{\the\@temptokena\the\toks@}% - \toks@\expandafter{\bbl@tempc#3}% - \expandafter\edef\csname extras\languagename\endcsname{\the\toks@}% - \fi} \bbl@trace{Compatibility with language.def} \ifx\bbl@languages\@undefined \ifx\directlua\@undefined @@ -1222,7 +1041,7 @@ \newcommand\EnableBabelHook[1]{\bbl@csarg\let{hk@#1}\@firstofone} \newcommand\DisableBabelHook[1]{\bbl@csarg\let{hk@#1}\@gobble} \def\bbl@usehooks{\bbl@usehooks@lang\languagename} -\def\bbl@usehooks@lang#1#2#3{% +\def\bbl@usehooks@lang#1#2#3{% Test for Plain \ifx\UseHook\@undefined\else\UseHook{babel/*/#2}\fi \def\bbl@elth##1{% \bbl@cs{hk@##1}{\bbl@cs{ev@##1@#2@}#3}}% @@ -1239,7 +1058,7 @@ beforeextras=0,afterextras=0,stopcommands=0,stringprocess=0,% hyphenation=2,initiateactive=3,afterreset=0,foreign=0,foreign*=0,% beforestart=0,languagename=2,begindocument=1} -\ifx\NewHook\@undefined\else +\ifx\NewHook\@undefined\else % Test for Plain (?) \def\bbl@tempa#1=#2\@@{\NewHook{babel/#1}} \bbl@foreach\bbl@evargs{\bbl@tempa#1\@@} \fi @@ -1948,7 +1767,7 @@ \def\bbl@toglobal#1{\global\let#1#1} \@ifpackagewith{babel}{nocase}% {\let\bbl@patchuclc\relax}% - {\def\bbl@patchuclc{% + {\def\bbl@patchuclc{% TODO. Delete. Doesn’t work any more. \global\let\bbl@patchuclc\relax \g@addto@macro\@uclclist{\reserved@b{\reserved@b\bbl@uclc}}% \gdef\bbl@uclc##1{% @@ -2470,6 +2289,7 @@ \let\bbl@calendars\@empty \global\let\bbl@inidata\@empty \global\let\bbl@extend@ini\@gobble + \global\let\bbl@included@inis\@empty \gdef\bbl@key@list{;}% \bbl@forkv{#1}{% \in@{/}{##1}% With /, (re)sets a value in the ini @@ -2535,6 +2355,14 @@ {}% With \bbl@load@basic below {\bbl@provide@renew{#2}}% \fi + % == include == TODO + % \ifx\bbl@included@inis\@empty\else + % \bbl@replace\bbl@included@inis{ }{,}% + % \bbl@foreach\bbl@included@inis{% + % \openin\bbl@readstream=babel-##1.ini + % \bbl@extend@ini{#2}}% + % \closein\bbl@readstream + % \fi % Post tasks % ---------- % == subsequent calls after the first provide for a locale == @@ -2557,11 +2385,6 @@ \\\bbl@toglobal\<bbl@ensure@\languagename>% \\\bbl@toglobal\<bbl@ensure@\languagename\space>}% \fi - % == - % At this point all parameters are defined if 'import'. Now we - % execute some code depending on them. But what about if nothing was - % imported? We just set the basic parameters, but still loading the - % whole ini file. \bbl@load@basic{#2}% % == script, language == % Override the values from ini or defines them @@ -2976,7 +2799,7 @@ \ifin@\else \bbl@xin@{,identification/include.}% {,\bbl@section/\bbl@tempa}% - \ifin@\edef\bbl@required@inis{\the\toks@}\fi + \ifin@\xdef\bbl@included@inis{\the\toks@}\fi \bbl@exp{% \\\g@addto@macro\\\bbl@inidata{% \\\bbl@elt{\bbl@section}{\bbl@tempa}{\the\toks@}}}% @@ -3024,16 +2847,9 @@ \let\bbl@inistore\bbl@inistore@min % Remember it's local \fi \def\bbl@section{identification}% - \let\bbl@required@inis\@empty \bbl@exp{\\\bbl@inistore tag.ini=#1\\\@@}% \bbl@inistore load.level=#2\@@ \bbl@loop@ini - \ifx\bbl@required@inis\@empty\else - \bbl@replace\bbl@required@inis{ }{,}% - \bbl@foreach\bbl@required@inis{% - \openin\bbl@readstream=babel-##1.ini - \bbl@loop@ini}% - \fi % == Process stored data == \bbl@csarg\xdef{lini@\languagename}{#1}% \bbl@read@ini@aux @@ -3675,13 +3491,18 @@ \@namedef{bbl@info@extension.x.tag.bcp47}{extx} \providecommand\BCPdata{} \ifx\renewcommand\@undefined\else % For plain. TODO. It’s a quick fix - \renewcommand\BCPdata[1]{% + \renewcommand\BCPdata[1]{\bbl@bcpdata@i#1\@empty} + \def\bbl@bcpdata@i#1#2#3#4#5#6\@empty{% + \@nameuse{str_if_eq:nnTF}{#1#2#3#4#5}{main.}% + {\bbl@bcpdata@ii{#6}\bbl@main@language}% + {\bbl@bcpdata@ii{#1#2#3#4#5#6}\languagename}}% + \def\bbl@bcpdata@ii#1#2{% \bbl@ifunset{bbl@info@#1.tag.bcp47}% {\bbl@error{Unknown field '#1' in \string\BCPdata.\\% Perhaps you misspelled it.}% {See the manual for details.}}% - {\bbl@ifunset{bbl@\csname bbl@info@#1.tag.bcp47\endcsname @\languagename}{}% - {\bbl@cs{\csname bbl@info@#1.tag.bcp47\endcsname @\languagename}}}} + {\bbl@ifunset{bbl@\csname bbl@info@#1.tag.bcp47\endcsname @#2}{}% + {\bbl@cs{\csname bbl@info@#1.tag.bcp47\endcsname @#2}}}} \fi \@namedef{bbl@info@casing.tag.bcp47}{casing} \let\bbl@ensureinfo\@gobble @@ -3837,11 +3658,6 @@ \def\bbl@savelastskip##1\bbl@restorelastskip{}} \@namedef{bbl@ADJ@select.encoding@off}{% \let\bbl@encoding@select@off\@empty} -\ifx\directlua\@undefined\else - \ifx\bbl@luapatterns\@undefined - \input luababel.def - \fi -\fi \bbl@trace{Cross referencing macros} \ifx\bbl@opt@safe\@empty\else % ie, if 'ref' and/or 'bib' \def\@newl@bel#1#2#3{% @@ -4309,10 +4125,12 @@ \bbl@load@language{hebrew}} \DeclareOption{hungarian}{\bbl@try@load@lang{}{magyar}{}} \DeclareOption{lowersorbian}{\bbl@try@load@lang{}{lsorbian}{}} +\DeclareOption{northernsami}{\bbl@try@load@lang{}{samin}{}} \DeclareOption{nynorsk}{\bbl@try@load@lang{}{norsk}{}} \DeclareOption{polutonikogreek}{% \bbl@try@load@lang{}{greek}{\languageattribute{greek}{polutoniko}}} \DeclareOption{russian}{\bbl@try@load@lang{}{russianb}{}} +\DeclareOption{scottishgaelic}{\bbl@try@load@lang{}{scottish}{}} \DeclareOption{ukrainian}{\bbl@try@load@lang{}{ukraineb}{}} \DeclareOption{uppersorbian}{\bbl@try@load@lang{}{usorbian}{}} \ifx\bbl@opt@config\@nnil |