diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/babel/babel.def')
-rw-r--r-- | Master/texmf-dist/tex/generic/babel/babel.def | 79 |
1 files changed, 48 insertions, 31 deletions
diff --git a/Master/texmf-dist/tex/generic/babel/babel.def b/Master/texmf-dist/tex/generic/babel/babel.def index 6db9b31282e..cd6e92b3584 100644 --- a/Master/texmf-dist/tex/generic/babel/babel.def +++ b/Master/texmf-dist/tex/generic/babel/babel.def @@ -40,7 +40,7 @@ \wlog{File: #1 #4 #3 <#2>}% \let\ProvidesFile\@undefined} \fi -\ProvidesFile{babel.def}[2017/10/04 3.14 Babel common definitions] +\ProvidesFile{babel.def}[2017/11/03 3.15 Babel common definitions] \ifx\AtBeginDocument\@undefined \input plain.def\relax \fi @@ -83,7 +83,9 @@ \bbl@ifunset{\bbl@stripslash#1}% {\def#1{#2}}% {\expandafter\def\expandafter#1\expandafter{#1#2}}} +\def\bbl@xin@{\@expandtwoargs\in@} \def\bbl@csarg#1#2{\expandafter#1\csname bbl@#2\endcsname}% +\def\bbl@cs#1{\csname bbl@#1\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,{% @@ -688,7 +690,7 @@ \ifx\bbl@known@attribs\@undefined \in@false \else - \@expandtwoargs\in@{,\bbl@tempc-##1,}{,\bbl@known@attribs,}% + \bbl@xin@{,\bbl@tempc-##1,}{,\bbl@known@attribs,}% \fi \ifin@ \bbl@warning{% @@ -708,7 +710,7 @@ {The attribute #2 is unknown for language #1.}% {Your command will be ignored, type <return> to proceed}} \def\bbl@declare@ttribute#1#2#3{% - \@expandtwoargs\in@{,#2,}{,\BabelModifiers,}% + \bbl@xin@{,#2,}{,\BabelModifiers,}% \ifin@ \AfterBabelLanguage{#1}{\languageattribute{#1}{#2}}% \fi @@ -718,7 +720,7 @@ \ifx\bbl@known@attribs\@undefined \in@false \else - \@expandtwoargs\in@{,#1-#2,}{,\bbl@known@attribs,}% + \bbl@xin@{,#1-#2,}{,\bbl@known@attribs,}% \fi \ifin@ \bbl@afterelse#3% @@ -952,8 +954,7 @@ \expandafter \bbl@toglobal\csname####1\string##1\endcsname}}}% \def\bbl@sctest{% - \@expandtwoargs - \in@{,\bbl@opt@strings,}{,\bbl@sc@label,\bbl@sc@fontenc,}}% + \bbl@xin@{,\bbl@opt@strings,}{,\bbl@sc@label,\bbl@sc@fontenc,}}% \fi \ifx\bbl@opt@strings\@nnil % ie, no strings key -> defaults \else\ifx\bbl@opt@strings\relax % ie, strings=encoded @@ -982,14 +983,14 @@ \fi} \def\bbl@forlang#1#2{% \bbl@for#1\bbl@L{% - \@expandtwoargs\in@{,#1,}{,\BabelLanguages,}% + \bbl@xin@{,#1,}{,\BabelLanguages,}% \ifin@#2\relax\fi}} \def\bbl@scswitch{% \bbl@forlang\bbl@tempa{% \ifx\bbl@G\@empty\else \ifx\SetString\@gobbletwo\else \edef\bbl@GL{\bbl@G\bbl@tempa}% - \@expandtwoargs\in@{,\bbl@GL,}{,\bbl@screset,}% + \bbl@xin@{,\bbl@GL,}{,\bbl@screset,}% \ifin@\else \global\expandafter\let\csname\bbl@GL\endcsname\@undefined \xdef\bbl@screset{\bbl@screset,\bbl@GL}% @@ -1065,7 +1066,7 @@ \bbl@tempa} \AtEndOfPackage{% \ifx\bbl@opt@hyphenmap\@undefined - \@expandtwoargs\in@{,}{\bbl@language@opts}% + \bbl@xin@{,}{\bbl@language@opts}% \chardef\bbl@opt@hyphenmap\ifin@4\else\@ne\fi \fi} \def\set@low@box#1{\setbox\tw@\hbox{,}\setbox\z@\hbox{#1}% @@ -1259,6 +1260,9 @@ \let\bbl@KVP@captions\@nil \let\bbl@KVP@import\@nil \let\bbl@KVP@main\@nil + \let\bbl@KVP@script\@nil + \let\bbl@KVP@language\@nil + \let\bbl@KVP@dir\@nil \let\bbl@KVP@hyphenrules\@nil \bbl@forkv{#1}{\bbl@csarg\def{KVP@##1}{##2}}% TODO - error handling \ifx\bbl@KVP@captions\@nil @@ -1275,6 +1279,12 @@ {Use this macro as documented}}% {\bbl@provide@renew{#2}}}% \bbl@exp{\\\babelensure[exclude=\\\today]{#2}}% + \ifx\bbl@KVP@script\@nil\else + \bbl@csarg\edef{sname@#2}{\bbl@KVP@script}% + \fi + \ifx\bbl@KVP@language\@nil\else + \bbl@csarg\edef{lname@#2}{\bbl@KVP@language}% + \fi \let\languagename\bbl@savelangname} \def\bbl@provide@new#1{% \@namedef{date#1}{}% marks lang exists - required by \StartBabelCommands @@ -1346,14 +1356,14 @@ \bbl@exp{% and hyphenrules is not empty \\\bbl@ifblank{\@nameuse{bbl@hyphr@#1}}% {}% - {\\\adddialect\<l@#1>\<l@\@nameuse{bbl@hyphr@\languagename}>}}% + {\let\\\bbl@tempa\<l@\@nameuse{bbl@hyphr@\languagename}>}}% \fi - \bbl@ifunset{l@#1}% no hyphenrules found - fallback - {\bbl@exp{\\\adddialect\<l@#1>\language}}% - {}% - \else - \bbl@exp{\\\adddialect\<l@#1>\bbl@tempa}% found in opt list - \fi} + \fi + \bbl@ifunset{bbl@tempa}% ie, relax or undefined + {\bbl@ifunset{l@#1}% no hyphenrules found - fallback + {\bbl@exp{\\\adddialect\<l@#1>\language}}% + {}}% so, l@<lang> is ok - nothing to do + {\bbl@exp{\\\adddialect\<l@#1>\bbl@tempa}}}% found in opt list or ini \def\bbl@read@ini#1{% \openin1=babel-#1.ini \ifeof1 @@ -1532,7 +1542,7 @@ \@tempswatrue \fi} \fi -\@expandtwoargs\in@{R}\bbl@opt@safe +\bbl@xin@{R}\bbl@opt@safe \ifin@ \bbl@redefinerobust\ref#1{% \@safe@activestrue\org@ref{#1}\@safe@activesfalse} @@ -1542,7 +1552,7 @@ \let\org@ref\ref \let\org@pageref\pageref \fi -\@expandtwoargs\in@{B}\bbl@opt@safe +\bbl@xin@{B}\bbl@opt@safe \ifin@ \bbl@redefine\@citex[#1]#2{% \@safe@activestrue\edef\@tempa{#2}\@safe@activesfalse @@ -1602,7 +1612,7 @@ {\@temptokena\expandafter{\bbl@tempb{#2}}}% \bbl@exp{\\\org@markboth{\the\toks@}{\the\@temptokena}}} \bbl@tempc -\@expandtwoargs\in@{R}\bbl@opt@safe +\bbl@xin@{R}\bbl@opt@safe \ifin@ \AtBeginDocument{% \@ifpackageloaded{ifthen}{% @@ -1681,7 +1691,7 @@ \in@false \bbl@foreach\BabelNonASCII{% is there a non-ascii enc? \ifin@\else - \lowercase{\@expandtwoargs\in@{,#1enc.def,}{,\@filelist,}}% + \lowercase{\bbl@xin@{,#1enc.def,}{,\@filelist,}}% \fi}% \ifin@ % if a non-ascii has been loaded \def\ensureascii#1{{\fontencoding{OT1}\selectfont#1}}% @@ -1692,7 +1702,7 @@ \ifx\@empty#2\else \bbl@ifunset{T@#1}% {}% - {\@expandtwoargs\in@{,#1,}{,\BabelNonASCII,}% + {\bbl@xin@{,#1,}{,\BabelNonASCII,}% \ifin@ \DeclareTextCommand{\TeX}{#1}{\ensureascii{\org@TeX}}% \DeclareTextCommand{\LaTeX}{#1}{\ensureascii{\org@LaTeX}}% @@ -1701,7 +1711,7 @@ \fi}% \fi}% \bbl@foreach\@filelist{\bbl@tempb#1\@@}% TODO - \@@ de mas?? - \@expandtwoargs\in@{,\cf@encoding,}{,\BabelNonASCII,}% + \bbl@xin@{,\cf@encoding,}{,\BabelNonASCII,}% \ifin@\else \edef\ensureascii#1{{% \noexpand\fontencoding{\cf@encoding}\noexpand\selectfont#1}}% @@ -1738,15 +1748,20 @@ Nabataean,N'Ko,Orkhon,Palmyrene,Inscriptional Pahlavi,% Psalter Pahlavi,Phoenician,Inscriptional Parthian,Samaritan,% Old South Arabian,}% -\def\bbl@ensuredir{% - \@expandtwoargs - \in@{\csname bbl@script@\languagename\endcsname}% - {\bbl@alscripts\bbl@rscripts}% +\def\bbl@provide@dirs#1{% + \bbl@xin@{\csname bbl@sname@#1\endcsname}{\bbl@alscripts\bbl@rscripts}% \ifin@ - \bbl@setdirs\@ne + \global\bbl@csarg\chardef{wdir@#1}\@ne + \bbl@xin@{\csname bbl@sname@#1\endcsname}{\bbl@alscripts}% + \ifin@ + \global\bbl@csarg\chardef{wdir@#1}\tw@ % useless in xetex + \fi \else - \bbl@setdirs\z@ + \global\bbl@csarg\chardef{wdir@#1}\z@ \fi} +\def\bbl@switchdir{% + \bbl@ifunset{bbl@wdir@\languagename}{\bbl@provide@dirs{\languagename}}{}% + \bbl@exp{\\\bbl@setdirs\bbl@cs{wdir@\languagename}}} \def\bbl@setdirs#1{% TODO - math \ifcase\bbl@select@type % TODO - strictly, not the right test \bbl@pagedir{#1}% @@ -1756,7 +1771,7 @@ \bbl@textdir{#1}} \ifcase\bbl@engine \or - \AddBabelHook{babel-bidi}{afterextras}{\bbl@ensuredir} + \AddBabelHook{babel-bidi}{afterextras}{\bbl@switchdir} \DisableBabelHook{babel-bidi} \def\bbl@getluadir#1{% \directlua{ @@ -1775,13 +1790,15 @@ #2 TRT\relax \fi \fi} - \def\bbl@textdir{\bbl@setdir{text}\textdir}% TODO - ?\linedir + \def\bbl@textdir#1{% + \bbl@setdir{text}\textdir{#1}% TODO - ?\linedir + \setattribute\bbl@attr@dir{#1}} \def\bbl@pardir{\bbl@setdir{par}\pardir} \def\bbl@bodydir{\bbl@setdir{body}\bodydir} \def\bbl@pagedir{\bbl@setdir{page}\pagedir} \def\bbl@dirparastext{\pardir\the\textdir\relax}% %%%% \or - \AddBabelHook{babel-bidi}{afterextras}{\bbl@ensuredir} + \AddBabelHook{babel-bidi}{afterextras}{\bbl@switchdir} \DisableBabelHook{babel-bidi} \newcount\bbl@dirlevel \chardef\bbl@thetextdir\z@ |