diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/babel/babel.sty')
-rw-r--r-- | Master/texmf-dist/tex/generic/babel/babel.sty | 79 |
1 files changed, 54 insertions, 25 deletions
diff --git a/Master/texmf-dist/tex/generic/babel/babel.sty b/Master/texmf-dist/tex/generic/babel/babel.sty index c5ce24b584f..bd3fe93537c 100644 --- a/Master/texmf-dist/tex/generic/babel/babel.sty +++ b/Master/texmf-dist/tex/generic/babel/babel.sty @@ -32,7 +32,7 @@ %% extension |.ins|) which are part of the distribution. %% \NeedsTeXFormat{LaTeX2e}[2005/12/01] -\ProvidesPackage{babel}[2017/11/03 3.15 The Babel package] +\ProvidesPackage{babel}[2018/01/04 3.16 The Babel package] \@ifpackagewith{babel}{debug} {\let\bbl@debug\@firstofone} {\let\bbl@debug\@gobble} @@ -179,23 +179,25 @@ \fi}% \bbl@languages \fi -\@ifpackagewith{babel}{bidi=basic-r}{% must go before any \DeclareOption - \let\bbl@beforeforeign\leavevmode - \AtEndOfPackage{\EnableBabelHook{babel-bidi}}% - \RequirePackage{luatexbase}% - \directlua{ - require('babel-bidi.lua') - require('babel-bidi-basic-r.lua') - luatexbase.add_to_callback('pre_linebreak_filter', - Babel.pre_otfload, - 'Babel.pre_otfload', - luatexbase.priority_in_callback('pre_linebreak_filter', - 'luaotfload.node_processor') or nil) - luatexbase.add_to_callback('hpack_filter', - Babel.pre_otfload, - 'Babel.pre_otfload', - luatexbase.priority_in_callback('hpack_filter', - 'luaotfload.node_processor') or nil)}}{} +\ifodd\bbl@engine + \@ifpackagewith{babel}{bidi=basic-r}{% must go before any \DeclareOption + \let\bbl@beforeforeign\leavevmode + \AtEndOfPackage{\EnableBabelHook{babel-bidi}}% + \RequirePackage{luatexbase}% + \directlua{ + require('babel-bidi.lua') + require('babel-bidi-basic-r.lua') + luatexbase.add_to_callback('pre_linebreak_filter', + Babel.pre_otfload, + 'Babel.pre_otfload', + luatexbase.priority_in_callback('pre_linebreak_filter', + 'luaotfload.node_processor') or nil) + luatexbase.add_to_callback('hpack_filter', + Babel.pre_otfload, + 'Babel.pre_otfload', + luatexbase.priority_in_callback('hpack_filter', + 'luaotfload.node_processor') or nil)}}{} +\fi \@ifpackagewith{babel}{base}{% \ifx\directlua\@undefined \DeclareOption*{\bbl@patterns{\CurrentOption}}% @@ -250,24 +252,40 @@ \DeclareOption{safe=none}{\let\bbl@opt@safe\@empty} \DeclareOption{safe=bib}{\def\bbl@opt@safe{B}} \DeclareOption{safe=ref}{\def\bbl@opt@safe{R}} -\DeclareOption{bidi=basic-r}% - {\newattribute\bbl@attr@dir - \let\bbl@beforeforeign\leavevmode - \AtEndOfPackage{\EnableBabelHook{babel-bidi}}} +\ifodd\bbl@engine + \DeclareOption{bidi=basic-r}% + {\let\bbl@beforeforeign\leavevmode + \newattribute\bbl@attr@dir + \bbl@exp{\output{\bodydir\pagedir\the\output}}% + \AtEndOfPackage{\EnableBabelHook{babel-bidi}}} +\else + \DeclareOption{bidi=basic-r}% + {\bbl@error + {The bidi method `basic-r' is available only in\\% + luatex. I'll continue with `bidi=default', so\\% + expect wrong results}% + {See the manual for further details.}% + \let\bbl@beforeforeign\leavevmode + \AtEndOfPackage{% + \EnableBabelHook{babel-bidi}% + \bbl@xebidipar}} +\fi \DeclareOption{bidi=default}% {\let\bbl@beforeforeign\leavevmode - \ifcase\bbl@engine\or + \ifodd\bbl@engine \newattribute\bbl@attr@dir + \bbl@exp{\output{\bodydir\pagedir\the\output}}% \fi \AtEndOfPackage{% \EnableBabelHook{babel-bidi}% - \ifcase\bbl@engine\or\or + \ifodd\bbl@engine\else \bbl@xebidipar \fi}} \let\bbl@opt@shorthands\@nnil \let\bbl@opt@config\@nnil \let\bbl@opt@main\@nnil \let\bbl@opt@headfoot\@nnil +\let\bbl@opt@layout\@nnil \def\bbl@tempa#1=#2\bbl@tempa{% \bbl@csarg\ifx{opt@#1}\@nnil \bbl@csarg\edef{opt@#1}{#2}% @@ -276,7 +294,7 @@ Bad option `#1=#2'. Either you have misspelled the\\% key or there is a previous setting of `#1'}{% Valid keys are `shorthands', `config', `strings', `main',\\% - `headfoot', `safe', `math'} + `headfoot', `safe', `math', among others.} \fi} \let\bbl@language@opts\@empty \DeclareOption*{% @@ -328,6 +346,17 @@ \ifx\bbl@language@opts\@empty\else\bbl@language@opts,\fi \bbl@opt@main} \fi +\ifx\bbl@opt@layout\@nnil + \newcommand\IfBabelLayout[3]{#3}% +\else + \newcommand\IfBabelLayout[1]{% + \@expandtwoargs\in@{.#1.}{.\bbl@opt@layout.}% + \ifin@ + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi} +\fi \let\bbl@afterlang\relax \let\BabelModifiers\relax \let\bbl@loaded\@empty |