diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/babel/luababel.def')
-rw-r--r-- | Master/texmf-dist/tex/generic/babel/luababel.def | 115 |
1 files changed, 85 insertions, 30 deletions
diff --git a/Master/texmf-dist/tex/generic/babel/luababel.def b/Master/texmf-dist/tex/generic/babel/luababel.def index 3a3519c1989..7829e7cd41c 100644 --- a/Master/texmf-dist/tex/generic/babel/luababel.def +++ b/Master/texmf-dist/tex/generic/babel/luababel.def @@ -39,15 +39,79 @@ %% extension .ins) which are part of the distribution. %% File `bbunicode.dtx' %% Babel package for LaTeX version 2e -%% Copyright (C) 2103-2014 +%% Copyright (C) 2103-2016 %% by Javier Bezos +\ifx\bbl@get@enc\@undefined + \def\bbl@process@line#1#2 #3 #4 {% + \ifx=#1% + \bbl@process@synonym{#2}% + \else + \bbl@process@language{#1#2}{#3}{#4}% + \fi + \ignorespaces} + \def\bbl@process@language#1#2#3{% + \@ifundefined{l@#1}% + {\expandafter\addlanguage\csname l@#1\endcsname + \expandafter\language\csname l@#1\endcsname + \let\bbl@elt\relax + \edef\bbl@languages{% + \bbl@languages\bbl@elt{#1}{\the\language}{#2}{#3}}}% + {}} + \def\bbl@process@synonym#1{% + \@ifundefined{l@#1}% + {\expandafter\chardef\csname l@#1\endcsname\last@language + \let\bbl@elt\relax + \edef\bbl@languages{% + \bbl@languages\bbl@elt{#1}{\the\last@language}{}{}}}% + {}} + \ifnum\last@language>\z@ + \bbl@warning{Wrong or old hyphenation setup. Please, rebuild\\% + the format. I'll try to fix it for this run.\\% + Reported}% + \def\bbl@elt#1#2#3#4{% + \ifnum#2>\z@\else + \noexpand\bbl@elt{#1}{#2}{#3}{#4}% + \fi}% + \edef\bbl@languages{\bbl@languages}% + \fi + \ifnum\l@english=\z@\else + \bbl@warning{Wrong hyphenation setup. The 0th language must\\% + be `english'. Reported}% + \fi + \@namedef{bbl@hyphendata@0}{{hyphen.tex}{}}% + \openin1=language.dat + \ifeof1 + \bbl@warning{I couldn't find language.dat. No additional\\% + patterns loaded. Reported}% + \else + \loop + \endlinechar\m@ne + \read1 to \bbl@line + \endlinechar`\^^M + \if T\ifeof1F\fi T\relax + \ifx\bbl@line\@empty\else + \edef\bbl@line{\bbl@line\space\space\space}% + \expandafter\bbl@process@line\bbl@line\relax + \fi + \repeat + \fi + \def\bbl@get@enc#1:#2:#3\@@@{\def\bbl@hyph@enc{#2}} + \def\bbl@luapatterns#1#2{% + \bbl@get@enc#1::\@@@ + \begingroup + \input #1\relax + \endgroup + \def\bbl@tempa{#2}% + \ifx\bbl@tempa\@empty\else + \input #2\relax + \fi}% +\fi \begingroup \catcode`\%=12 \catcode`\'=12 \catcode`\"=12 \catcode`\:=12 \directlua{ - require("luatex-hyphen") Babel = {} function Babel.bytes(line) return line:gsub("(.)", @@ -109,12 +173,23 @@ \luabbl@stop \let\luabbl@stop\relax} \AddBabelHook{luatex}{patterns}{% - \ifcsname lu@texhyphen@loaded@\the\language\endcsname \else - \global\@namedef{lu@texhyphen@loaded@\the\language}{}% - \directlua{ - luatexhyphen.loadlanguage([[\string#1]], - '\the\language')}% - \fi + \@ifundefined{bbl@hyphendata@\the\language}% + {\def\bbl@elt##1##2##3##4{% + \def\bbl@tempa{##1}% + \def\bbl@tempb{##3}% + \ifx\bbl@tempb\@empty\else % if not synonymous + \def\bbl@tempc{{##3}{##4}}% + \fi + \def\bbl@tempb{#2}% eg, spanish, dutch:OT1, etc. + \ifx\bbl@tempa\bbl@tempb + \bbl@csarg\edef{hyphendata@##2}{\bbl@tempc}% + \fi}% + \bbl@languages + \@ifundefined{bbl@hyphendata@\the\language}% + {\bbl@info{No hyphenation patterns were set for\\% + language ‘#2’. Reported}}% + {\expandafter\expandafter\expandafter\bbl@luapatterns + \csname bbl@hyphendata@\the\language\endcsname}}{}% \@ifundefined{bbl@patterns@}{}{% \begingroup \@expandtwoargs\in@{,\number\language,}{,\bbl@pttnlist}% @@ -131,29 +206,9 @@ \xdef\bbl@pttnlist{\bbl@pttnlist\number\language,}% \fi \endgroup}} -\AddBabelHook{luatex}{adddialect}{% - \ifx\directlua\relax\else - \directlua{ - luatexhyphen.adddialect([[\string#1]], - [[\string#2]]) - }% - \fi} \AddBabelHook{luatex}{everylanguage}{% - \directlua{ - processnow = (tex.language == 0) or - (luatexhyphen.lookupname([[\string#1]]) == nil)}% - \ifnum0=\directlua{tex.sprint(processnow and "0" or "1")}\relax - \global\@namedef{lu@texhyphen@loaded@\the\language}{}% - \fi} -\AddBabelHook{luatex}{loadpatterns}{% - \ifnum0=\directlua{tex.sprint(processnow and "0" or "1")}\relax - \input #1\relax - \fi} -\AddBabelHook{luatex}{loadexceptions}{% - \ifnum0=\directlua{tex.sprint(processnow and "0" or "1")}\relax - \input #1\relax - \fi - \directlua{processnow = nil}} + \def\process@language##1##2##3{% + \def\process@line####1####2 ####3 ####4 {}}} \@onlypreamble\babelpatterns \AtEndOfPackage{% \newcommand\babelpatterns[2][\@empty]{% |