summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/babel
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-02-25 22:40:43 +0000
committerKarl Berry <karl@freefriends.org>2016-02-25 22:40:43 +0000
commitb66747a1d8288392c4e1f855d26bfbde89b481da (patch)
tree8a529ead7ff5a2ed4c2c0ffca7ae0dd04f558082 /Master/texmf-dist/source/latex/babel
parent561ad89d0840ad3b9ddb197efec1739e5089f1b6 (diff)
babel (25feb16)
git-svn-id: svn://tug.org/texlive/trunk@39867 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/babel')
-rw-r--r--Master/texmf-dist/source/latex/babel/babel.dtx191
-rw-r--r--Master/texmf-dist/source/latex/babel/babel.ins32
-rw-r--r--Master/texmf-dist/source/latex/babel/bbunicode.dtx266
3 files changed, 364 insertions, 125 deletions
diff --git a/Master/texmf-dist/source/latex/babel/babel.dtx b/Master/texmf-dist/source/latex/babel/babel.dtx
index 4d8444ab9fe..612d5a9c08e 100644
--- a/Master/texmf-dist/source/latex/babel/babel.dtx
+++ b/Master/texmf-dist/source/latex/babel/babel.dtx
@@ -36,7 +36,7 @@
%\iffalse
%% File 'babel.dtx'
%\fi
-%%\ProvidesFile{babel.dtx}[2016/01/08 v3.9n The Babel package]
+%%\ProvidesFile{babel.dtx}[2016/02/24 v3.9q The Babel package]
%\iffalse
%
% Babel DOCUMENT-STYLE option for LaTeX version 2.09 or plain TeX;
@@ -45,7 +45,7 @@
%% Copyright (C) 1989-2008 by Johannes Braams,
%% TeXniek
%% all rights reserved.
-%% Copyright (C) 2013-2014 by Johannes Braams
+%% Copyright (C) 2013-2016 by Johannes Braams
%% TeXniek
%% by Javier Bezos
%% all rights reserved.
@@ -196,8 +196,8 @@
\vspace{2cm}\hspace{1.5cm}
\begin{minipage}{5cm}
\Large
-Version 3.9n\newline
-2016/01/08
+Version 3.9q\newline
+2016/02/24
\vspace{1cm}
\textit{Original author}\newline
@@ -1291,9 +1291,6 @@ Then you preprocess it with |devnag| \m{file}, which creates
|"8000|) as a shorthand can make \TeX{} enter in an infinite loop in
some rare cases. (Another issue in the `to do' list, although there
is a partial solution.)
-\item Plain \luatex{} does not load patterns on the fly. Since this
- format is not based on \babel{} but on \file{etex.src} further
- investigation is required. This is another task in the `to do' list.
\end{itemize}
The following packages can be useful, too (the list is still
@@ -1313,6 +1310,7 @@ far from complete):
some languages (kerning and spacing). Ligatures can be disabled.
\item[substitutefont] Combines fonts in several encodings.
\item[mkpattern] Generates hyphenation patterns.
+\item[tracklang] Tracks which languages have been requested.
\end{description}
\subsection{Future work}
@@ -1366,17 +1364,47 @@ Note you can set any feature required for the language -- not only
|Language|, but also |Script| or a local |.fea|. This makes those macros
a bit more verbose, but also more powerful.
-\section{Preloading languages with \file{language.dat}}
+\section{Loading languages with \file{language.dat}}
\TeX{} and most engines based on it (pdf\TeX, \xetex, $\epsilon$-\TeX,
the main exception being \luatex) require hyphenation patterns to be
-loaded when a format is created (eg, \LaTeX, Xe\LaTeX,
+preloaded when a format is created (eg, \LaTeX, Xe\LaTeX,
pdf\LaTeX). \babel{} provides a tool which has become standand in many
distributions and based on a ``configuration file'' named
\file{language.dat}. The exact way this file is used depends on the
distribution, so please, read the documentation for the latter (note
also some distributions generate the file with some tool).
+\New{3.9q} With \luatex, however, patterns are loaded on the fly when
+requested by the language (except the ``0th'' language, typically
+\textsf{english}, which is preloaded always).\footnote{This feature
+was added to 3.9o, but it was buggy. Both 3.9o and 3.9p are
+deprecated.} Until 3.9n, this task was delegated to the package
+\textsf{luatex-hyphen}, by Khaled Hosny, \'Elie Roux, and Manuel
+P\'egouri\'e-Gonnard, and required an extra file named
+|language.dat.lua|, but now a new mechanism has been devised based
+solely on |language.dat|. \textbf{You must rebuild the formats} if
+upgrading from a previous version. You may want to have a local
+|language.dat| for a particular project (for example, a book on
+Chemistry).\footnote{The loader for lua(e)tex is slightly different as
+it's not based on \babel{} but on \texttt{etex.src}. Until 3.9p it
+just didn't work, but thanks to the new code it works by reloading the
+data in the \babel{} way, i.e., with \texttt{language.dat}.}
+
+Unfortunately, the new model is intrinsically incompatible with the
+previous one, which means you can experience some problems with
+\textsf{polyglossia}. If using the latter, you must load the patterns
+with \babel{} as shown in the following example:
+\begin{verbatim}
+\usepackage[base,french,dutch,spanish,english]{babel}
+\usepackage{polyglossia}
+\setmainlanguage{french}
+\setotherlanguages{dutch,spanish,english}
+\end{verbatim}
+Be aware this is, very likely, a temporary solution.
+
+\subsection{Format}
+
In that file the person who maintains a \TeX\ environment has to record
for which languages he has hyphenation patterns \emph{and} in which
files these are stored\footnote{This is because different operating
@@ -1622,7 +1650,7 @@ explained in in sec. \ref{s:strings} (\babel{} 3.9 and later).
\begin{verbatim}
\ProvidesLanguage{<language>}
- [2016/01/08 v0.0 <Language> support from the babel system]
+ [2016/02/24 v0.0 <Language> support from the babel system]
\LdfInit{<language>}{captions<language>}
\ifx\undefined\l@<language>
@@ -2405,8 +2433,8 @@ help from Bernd Raichle, for which I am grateful.
% little bit of literate programming.
%
% \begin{macrocode}
-%<<version=3.9n>>
-%<<date=2016/01/08>>
+%<<version=3.9q>>
+%<<date=2016/02/24>>
% \end{macrocode}
%
% We define some basic macros which just make the code cleaner.
@@ -2436,9 +2464,9 @@ help from Bernd Raichle, for which I am grateful.
%<</Basic macros>>
% \end{macrocode}
%
-% Some files identify themselves with a \LaTeX{} macro. The following
-% code is placed before them to define (and then undefine) if not in
-% \LaTeX.
+% Some files identify themselves with a \LaTeX{} macro. The following
+% code is placed before them to define (and then undefine) if not in
+% \LaTeX.
%
% \begin{macrocode}
%<<*Make sure ProvidesFile is defined>>
@@ -2450,9 +2478,9 @@ help from Bernd Raichle, for which I am grateful.
%<</Make sure ProvidesFile is defined>>
% \end{macrocode}
%
-% The following code is used in \file{babel.sty} and
-% \file{babel.def}, and makes sure the current version of
-% |switch.ldf| is used, if different from that in the format.
+% The following code is used in \file{babel.sty} and \file{babel.def},
+% and makes sure the current version of |switch.ldf| is used, if
+% different from that in the format.
%
% \begin{macrocode}
%<<*Load switch if newer>>
@@ -2463,6 +2491,19 @@ help from Bernd Raichle, for which I am grateful.
%<</Load switch if newer>>
% \end{macrocode}
%
+% The following code is also used in \file{babel.sty} and
+% \file{babel.def}, and loads (only once) the data in |language.dat|.
+%
+% \begin{macrocode}
+%<<*Load patterns in luatex>>
+\ifx\directlua\@undefined\else
+ \ifx\bbl@luapatterns\@undefined
+ \input luababel.def
+ \fi
+\fi
+%<</Load patterns in luatex>>
+% \end{macrocode}
+%
% The following code is used in \file{babel.def} and
% \file{switch.def}.
%
@@ -2611,6 +2652,8 @@ help from Bernd Raichle, for which I am grateful.
% December 1994}
% \changes{babel~3.6k}{1999/03/18}{We need at least \LaTeX\ from
% June 1998}
+% \changes{babel~3.9q}{2016/02/11}{Load patterns with option base.
+% To be improved. Moved showlanguages before base}
% \begin{macrocode}
%<*package>
\NeedsTeXFormat{LaTeX2e}[2005/12/01]
@@ -2618,12 +2661,46 @@ help from Bernd Raichle, for which I am grateful.
\@ifpackagewith{babel}{debug}
{\input switch.def\relax}
{<@Load switch if newer@>}
+<@Load patterns in luatex@>
<@Basic macros@>
\def\AfterBabelLanguage#1{%
\global\expandafter\bbl@add\csname#1.ldf-h@@k\endcsname}%
+% \end{macrocode}
+% If the format created a list of loaded languages (in
+% |\bbl@languages|), get the name of the 0-th to show the actual
+% language used.
+% \begin{macrocode}
+\ifx\bbl@languages\@undefined\else
+ \begingroup
+ \catcode`\^^I=12
+ \@ifpackagewith{babel}{showlanguages}{%
+ \begingroup
+ \def\bbl@elt#1#2#3#4{\wlog{#2^^I#1^^I#3^^I#4}}%
+ \wlog{<*languages>}%
+ \bbl@languages
+ \wlog{</languages>}%
+ \endgroup}{}
+ \endgroup
+ \def\bbl@elt#1#2#3#4{%
+ \ifnum#2=\z@
+ \gdef\bbl@nulllanguage{#1}%
+ \def\bbl@elt##1##2##3##4{}%
+ \fi}%
+ \bbl@languages
+\fi
+% \end{macrocode}
+% Now the \texttt{base} option. With it we can define (and load, with
+% \luatex) hyphenation patterns, even if we are not interesed in the
+% rest of babel. Useful for \textsf{polyglossia}, too.
+% \begin{macrocode}
\@ifpackagewith{babel}{base}{%
- \DeclareOption*{\bbl@patterns{\CurrentOption}}%
+ \ifx\directlua\@undefined
+ \DeclareOption*{\bbl@patterns{\CurrentOption}}%
+ \else
+ \DeclareOption*{\bbl@patterns@lua{\CurrentOption}}%
+ \fi
\DeclareOption{base}{}%
+ \DeclareOption{showlanguages}{}%
\ProcessOptions
\global\expandafter\let\csname opt@babel.sty\endcsname\relax
\global\expandafter\let\csname ver@babel.sty\endcsname\relax
@@ -2819,29 +2896,6 @@ help from Bernd Raichle, for which I am grateful.
\bbl@opt@main}
\fi
% \end{macrocode}
-% If the format created a list of loaded languages (in
-% |\bbl@languages|), get the name of the 0-th to show the actual
-% language used.
-% \begin{macrocode}
-\ifx\bbl@languages\@undefined\else
- \begingroup
- \catcode`\^^I=12
- \@ifpackagewith{babel}{showlanguages}{%
- \begingroup
- \def\bbl@elt#1#2#3#4{\wlog{#2^^I#1^^I#3^^I#4}}%
- \wlog{<*languages>}%
- \bbl@languages
- \wlog{</languages>}%
- \endgroup}{}
- \endgroup
- \def\bbl@elt#1#2#3#4{%
- \ifnum#2=\z@
- \gdef\bbl@nulllanguage{#1}%
- \def\bbl@elt##1##2##3##4{}%
- \fi}%
- \bbl@languages
-\fi
-% \end{macrocode}
%
% \subsection{Language options}
%
@@ -3165,6 +3219,8 @@ help from Bernd Raichle, for which I am grateful.
% \changes{babel~3.9k}{2014/03/24}{Added definition for
% \cs{uselanguage}}
% \changes{babel~3.9n}{2015/12/21}{Define a few macros for 2.09}
+% \changes{babel~3.9p}{2016/02/05}{Added a test for lua(e)tex.}
+% \changes{babel~3.9q}{2016/02/12}{Load lua patterns if not lualatex.}
%
% \begin{macrocode}
%<*core>
@@ -3180,24 +3236,27 @@ help from Bernd Raichle, for which I am grateful.
\fi
<@Load switch if newer@>
\ifx\bbl@languages\@undefined
- \openin1 = language.def
- \ifeof1
- \closein1
- \message{I couldn't find the file language.def}
- \else
- \closein1
- \begingroup
- \def\addlanguage#1#2#3#4#5{%
- \expandafter\ifx\csname lang@#1\endcsname\relax\else
- \global\expandafter\let\csname l@#1\expandafter\endcsname
- \csname lang@#1\endcsname
- \fi}%
- \def\uselanguage#1{}%
- \input language.def
- \endgroup
+ \ifx\directlua\@undefined
+ \openin1 = language.def
+ \ifeof1
+ \closein1
+ \message{I couldn't find the file language.def}
+ \else
+ \closein1
+ \begingroup
+ \def\addlanguage#1#2#3#4#5{%
+ \expandafter\ifx\csname lang@#1\endcsname\relax\else
+ \global\expandafter\let\csname l@#1\expandafter\endcsname
+ \csname lang@#1\endcsname
+ \fi}%
+ \def\uselanguage#1{}%
+ \input language.def
+ \endgroup
+ \fi
\fi
\chardef\l@english\z@
\fi
+<@Load patterns in luatex@>
<@Basic macros@>
\def\bbl@csarg#1#2{\expandafter#1\csname bbl@#2\endcsname}%
\chardef\bbl@engine=%
@@ -6625,11 +6684,17 @@ help from Bernd Raichle, for which I am grateful.
% \changes{babel~3.6u}{1999/04/20}{Moved this code to
% \file{babel.def}}
% \changes{babel~3.9l}{2014/08/02}{fontspec used to set
-% \cs{latinencoding} to EUx, but now it doesn't. So, it's done here.}
+% \cs{latinencoding} to EUx, but now it doesn't. So, it's done
+% here.}
+% \changes{babel~3.9o}{2016/01/27}{With fontspec, first check if
+% \cs{UTFencname} exists.}
% \begin{macrocode}
\AtBeginDocument{%
\@ifpackageloaded{fontspec}%
- {\xdef\latinencoding{EU\ifcase\bbl@engine\or2\or1\fi}}%
+ {\xdef\latinencoding{%
+ \@ifundefined{UTFencname}%
+ {EU\ifcase\bbl@engine\or2\or1\fi}%
+ {\UTFencname}}}%
{\gdef\latinencoding{OT1}%
\ifx\cf@encoding\bbl@t@one
\xdef\latinencoding{\bbl@t@one}%
@@ -8270,11 +8335,14 @@ help from Bernd Raichle, for which I am grateful.
% \changes{babel~3.9g}{2013/07/28}{In non-LaTeX formats the number of
% languages were not printed. Moved from \cs{dump} and cleaned up:
% now \cs{toks}8 is expanded here.}
+% \changes{babel~3.9o}{2016/01/25}{The number of languages loaded was
+% off by 1.}
% \begin{macrocode}
\if/\the\toks@/\else
\errhelp{language.dat loads no language, only synonyms}
\errmessage{Orphan language synonym}
\fi
+\advance\last@language\@ne
\edef\bbl@tempa{%
\everyjob{%
\the\everyjob
@@ -8283,7 +8351,8 @@ help from Bernd Raichle, for which I am grateful.
\else
\noexpand\typeout
\fi
- {\the\toks8 \the\last@language\space languages loaded.}}}
+ {\the\toks8 \the\last@language\space language(s) loaded.}}}
+\advance\last@language\m@ne
\bbl@tempa
% \end{macrocode}
% Also remove some macros from memory and raise an error
@@ -8759,7 +8828,7 @@ help from Bernd Raichle, for which I am grateful.
\fi
\def\@testopt#1#2{%
\@ifnextchar[{#1}{#1[#2]}}
-\def\@protected@testopt#1{%%
+\def\@protected@testopt#1{%
\ifx\protect\@typeset@protect
\expandafter\@testopt
\else
diff --git a/Master/texmf-dist/source/latex/babel/babel.ins b/Master/texmf-dist/source/latex/babel/babel.ins
index ad476a6fa26..4028b50ff77 100644
--- a/Master/texmf-dist/source/latex/babel/babel.ins
+++ b/Master/texmf-dist/source/latex/babel/babel.ins
@@ -22,10 +22,6 @@
%%
%% The Current Maintainer of this work is Javier Bezos.
%%
-%% The list of all files belonging to the LaTeX base distribution is
-%% given in the file `manifest.bbl. See also `legal.bbl' for additional
-%% information.
-%%
%% The list of derived (unpacked) files belonging to the distribution
%% and covered by LPPL is defined by the unpacking scripts (with
%% extension .ins) which are part of the distribution.
@@ -37,12 +33,8 @@
%%
%% This file is part of the `babel' system.
%%
-%% You are allowed to distribute this file together with all files
-%% mentioned in manifest.bbl.
-%%
-%% You are not allowed to modify its contents.
%%
-\def\filedate{2014/03/24}
+\def\filedate{2016/02/05}
\def\batchfile{babel.ins}
\input docstrip.tex
@@ -62,16 +54,15 @@
\fi}
% Modify docstrip. A pseudo-guard is defined to set variables:
-% <<name=value>>. These variables are used with <@name@>
-% Two further pseudo-guards define "block" variables: <<*name>> and
-% <</name>> delimite the lines to be retrived with <@name@>. Note
-% the verbatim guard is overriden, which it's not used here.
-% It's done in two passes: 1) with saving true, blocks are always
-% read and saved; 2) with saving false, blocks are always ignored,
-% but replacing <@name@>.
-% While <@name@> can be used freely outside <<>>, it is only
-% allowed inside <<>> if previouly defined. Deeper nesting is
-% not allowed.
+% <<name=value>>. These variables are used with <@name@> Two further
+% pseudo-guards define "block" variables: <<*name>> and <</name>>
+% delimite the lines to be retrived with <@name@>. Note the verbatim
+% guard is overridden, but it's not used here. This is done in two
+% passes: 1) with saving true, there is a dummy pass, generating
+% nothing, but blocks are read and saved; 2) with saving false, blocks
+% are always ignored, but replacing <@name@>. While <@name@> can be
+% used freely outside <<>>, it's only allowed inside <<>> if
+% previously defined. Deeper nesting is not allowed.
\def\replaceVar#1<@#2{%
#1%
@@ -191,8 +182,6 @@ This file is a style file for the MakeIndex program
\usedir{tex/generic/babel}
-\askforoverwritefalse
-
\usepreamble\mainpreamble
% Dummy, it just read "modules" to be used when generating
@@ -228,7 +217,6 @@ This file is a style file for the MakeIndex program
}
% compatibility files
-
\def\compatfile#1{\file{#1.sty}{\from{bbcompat.dtx}{#1}}}
\generate{%
diff --git a/Master/texmf-dist/source/latex/babel/bbunicode.dtx b/Master/texmf-dist/source/latex/babel/bbunicode.dtx
index 02265c3108e..f41054716d4 100644
--- a/Master/texmf-dist/source/latex/babel/bbunicode.dtx
+++ b/Master/texmf-dist/source/latex/babel/bbunicode.dtx
@@ -31,12 +31,12 @@
% \iffalse
%<*dtx>
\ProvidesFile{bbunicode.dtx}
- [2016/01/05 v1.0f Babel hooks for Unicode engines]
+ [2016/02/24 v1.1c Babel hooks for Unicode engines]
%</dtx>
%
%% File `bbunicode.dtx'
%% Babel package for LaTeX version 2e
-%% Copyright (C) 2103-2014
+%% Copyright (C) 2103-2016
%% by Javier Bezos
%
%<*filedriver>
@@ -166,7 +166,7 @@
\ifx\bbl@tempa\@empty
\XeTeXinputencoding"bytes"%
\else
- \XeTeXinputencoding"#1"%
+ \XeTeXinputencoding"#1"%
\fi
\def\xebbl@stop{\XeTeXinputencoding"utf8"}}
\AddBabelHook{xetex}{stopcommands}{%
@@ -177,32 +177,215 @@
<@Font selection@>
%</xetex>
% \end{macrocode}
-% \subsection{LuaTeX}
%
-% This part relies on the |lua| stripts in \pkg{luatex-hyphen} by Khaled
-% Hosny, \'{E}lie Roux, and Manuel
-% P\'{e}gouri\'{e}-Gonnard. \'{E}lie also improved the code below.
-% \changes{bbunicode~1.0b}{2013/04/22}{luatex-hyphen is loaded
-% with require. Changes supplied by \'{E}lie Roux.}
+% \subsection{LuaTeX}
+%
+% The new loader for luatex is based solely on |language.dat|, which
+% is read on the fly. The code shouldn't be executed when the format
+% is build, so we check if |\AddBabelHook| is defined. Then comes a
+% modified version of the loader in |hyphen.cfg| (without the
+% hyphenmins stuff, which is under the direct control of \babel).
+%
+% The names |\l@<language>| are defined and take some value from the
+% beginning because all \texttt{ldf} files assume this for the
+% corresponding language to be considered valid, but patterns are not
+% loaded (except the first one). This is done later, when the language
+% is first selected (which usually means when the \texttt{ldf}
+% finishes). If a language has been loaded, |\bbl@hyphendata@<num>|
+% exists (with the names of the files read).
+%
+% The default setup preloads the first language into the format. This
+% is intended mainly for `english', so that it's available without
+% further intervention from the user. To avoid duplicating it, the
+% following rule applies: if the ``0th'' language and the first
+% language in |language.dat| have the same name then just ignore the
+% latter. If there are new synonymous, the are added, but note if the
+% language patterns have not been preloaded they won't at run time.
+%
+% Other preloaded languages could be read twice, if they has been
+% preloaded into the format. This is not optimal, but it shouldn't
+% happen very often -- with \luatex{} patterns are best loaded when
+% the document is typeset, and the ``0th'' language is preloaded just
+% for backwards compatibility.
+%
+% As of 1.1b, lua(e)tex is taken into account. Formerly, loading of
+% patterns on the fly didn't work in this format, but with the new
+% loader it does. Unfortunately, the format is not based on \babel,
+% and data could be duplicated, because languages are reassigned above
+% those in the format (nothing serious, anyway). Note even with this
+% format |language.dat| is used (under the principle of a single
+% source), instead of |language.def|.
+%
+% Of course, there is room for improvements, like tools to read and
+% reassign languages, which would require modifying the language list,
+% and better error handling.
+%
+% We need catcode tables, but no format (targeted by \babel) provide a
+% command to allocate them (although there are packages like
+% \textsf{ctablestack}). For the moment, a dangerous approach is used
+% -- just allocate a high random number and cross the fingers. To
+% complicate things, \textsf{etex.sty} changes the way languages are
+% allocated.
+%
+% \changes{bbunicode~1.0b}{2013/04/22}{luatex-hyphen is loaded with
+% require. Changes supplied by \'{E}lie Roux.}
% \changes{bbunicode~1.0c}{2014/03/10}{Defined hook for
% `initiateactive', to fetch the next token and continue only if
-% letter or other}
+% letter or other.}
% \changes{bbunicode~1.0d}{2014/03/21}{Removed the `misfeature' for
-% `initiateactive'}
+% `initiateactive'.}
% \changes{bbunicode~1.0e}{2015/05/10}{Use brackets instead of
-% \cs{luaescapestring}}
-% \changes{bbunicode~1.0e}{2015/07/26}{Added function addpatterns and
-% modified the patterns hook.}
+% \cs{luaescapestring}.}
+% \changes{bbunicode~1.0e}{2015/07/26}{Added function addpattern
+% and modified the patterns hook.}
+% \changes{bbunicode~1.1a}{2016/01/26}{New hyphenation loader for
+% luatex.}
+% \changes{bbunicode~1.1b}{2016/02/05}{Also lua(e)tex.}
+% \changes{bbunicode~1.1c}{2016/02/08}{Base reading of patterns on
+% number, not in name.}
+% \changes{bbunicode~1.1c}{2016/02/08}{Some hacks for polyglossia. To
+% be improved.}
+% \changes{bbunicode~1.1c}{2016/02/23}{Thoroughly revised.}
%
% \begin{macrocode}
%<*luatex>
+\ifx\AddBabelHook\@undefined
+\begingroup
+ \toks@{}
+ \count@\z@ % 0=start, 1=0th, 2=normal
+ \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@manylang{%
+ \ifnum\bbl@last>\@ne
+ \bbl@info{Non-standard hyphenation setup}%
+ \fi
+ \let\bbl@manylang\relax}
+ \def\bbl@process@language#1#2#3{%
+ \ifcase\count@
+ \@ifundefined{zth@#1}{\count@\tw@}{\count@\@ne}%
+ \or
+ \count@\tw@
+ \fi
+ \ifnum\count@=\tw@
+ \expandafter\addlanguage\csname l@#1\endcsname
+ \language\allocationnumber
+ \chardef\bbl@last\allocationnumber
+ \bbl@manylang
+ \let\bbl@elt\relax
+ \xdef\bbl@languages{%
+ \bbl@languages\bbl@elt{#1}{\the\language}{#2}{#3}}%
+ \fi
+ \the\toks@
+ \toks@{}}
+ \def\bbl@process@synonym@aux#1#2{%
+ \global\expandafter\chardef\csname l@#1\endcsname#2\relax
+ \let\bbl@elt\relax
+ \xdef\bbl@languages{%
+ \bbl@languages\bbl@elt{#1}{#2}{}{}}}%
+ \def\bbl@process@synonym#1{%
+ \ifcase\count@
+ \toks@\expandafter{\the\toks@\relax\bbl@process@synonym{#1}}%
+ \or
+ \@ifundefined{zth@#1}{\bbl@process@synonym@aux{#1}{0}}{}%
+ \else
+ \bbl@process@synonym@aux{#1}{\the\bbl@last}%
+ \fi}
+ \ifx\bbl@languages\@undefined % Just a (sensible?) guess
+ \chardef\l@english\z@
+ \chardef\l@USenglish\z@
+ \chardef\bbl@last\z@
+ \global\@namedef{bbl@hyphendata@0}{{hyphen.tex}{}}
+ \gdef\bbl@languages{%
+ \bbl@elt{english}{0}{hyphen.tex}{}%
+ \bbl@elt{USenglish}{0}{}{}}
+ \else
+ \global\let\bbl@languages@format\bbl@languages
+ \def\bbl@elt#1#2#3#4{% Remove all except language 0
+ \ifnum#2>\z@\else
+ \noexpand\bbl@elt{#1}{#2}{#3}{#4}%
+ \fi}%
+ \xdef\bbl@languages{\bbl@languages}%
+ \fi
+ \def\bbl@elt#1#2#3#4{\@namedef{zth@#1}{}} % Define flags
+ \bbl@languages
+ \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
+\endgroup
+\def\bbl@get@enc#1:#2:#3\@@@{\def\bbl@hyph@enc{#2}}
+\def\bbl@luapatterns#1#2{%
+ \bbl@get@enc#1::\@@@
+ \begingroup
+ \ifx\catcodetable\@undefined
+ \let\savecatcodetable\luatexsavecatcodetable
+ \let\initcatcodetable\luatexinitcatcodetable
+ \let\catcodetable\luatexcatcodetable
+ \fi
+ \savecatcodetable5211
+ \initcatcodetable5212
+ \catcodetable5212
+ \catcode`\#=6 \catcode`\$=3 \catcode`\&=4 \catcode`\^=7
+ \catcode`\_=8 \catcode`\{=1 \catcode`\}=2 \catcode`\~=13
+ \catcode`\@=11 \catcode`\^^I=10 \catcode`\^^J=12
+ \catcode`\<=12 \catcode`\>=12 \catcode`\*=12 \catcode`\.=12
+ \catcode`\-=12 \catcode`\/=12 \catcode`\[=12 \catcode`\]=12
+ \catcode`\`=12 \catcode`\'=12 \catcode`\"=12
+ \input #1\relax
+ \catcodetable5211
+ \endgroup
+ \def\bbl@tempa{#2}%
+ \ifx\bbl@tempa\@empty\else
+ \input #2\relax
+ \fi}%
+\def\bbl@patterns@lua#1{%
+ \language=\expandafter\ifx\csname l@#1:\f@encoding\endcsname\relax
+ \csname l@#1\endcsname
+ \edef\bbl@tempa{#1}%
+ \else
+ \csname l@#1:\f@encoding\endcsname
+ \edef\bbl@tempa{#1:\f@encoding}%
+ \fi\relax
+ \@namedef{lu@texhyphen@loaded@\the\language}{}% Temp
+ \@ifundefined{bbl@hyphendata@\the\language}%
+ {\def\bbl@elt##1##2##3##4{%
+ \ifnum##2=\csname l@\bbl@tempa\endcsname % #2=spanish, dutch:OT1...
+ \def\bbl@tempb{##3}%
+ \ifx\bbl@tempb\@empty\else % if not a synonymous
+ \def\bbl@tempc{{##3}{##4}}%
+ \fi
+ \bbl@csarg\edef{hyphendata@##2}{\bbl@tempc}%
+ \fi}%
+ \bbl@languages
+ \@ifundefined{bbl@hyphendata@\the\language}%
+ {\bbl@info{No hyphenation patterns were set for\\%
+ language ‘\bbl@tempa’. Reported}}%
+ {\expandafter\expandafter\expandafter\bbl@luapatterns
+ \csname bbl@hyphendata@\the\language\endcsname}}{}}
+\endinput\fi
\begingroup
\catcode`\%=12
\catcode`\'=12
\catcode`\"=12
\catcode`\:=12
\directlua{
- require("luatex-hyphen")
Babel = {}
function Babel.bytes(line)
return line:gsub("(.)",
@@ -264,12 +447,21 @@
\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{%
+ \ifnum##2=\csname l@#2\endcsname % #2=spanish, dutch:OT1...
+ \def\bbl@tempb{##3}%
+ \ifx\bbl@tempb\@empty\else % if not a synonymous
+ \def\bbl@tempc{{##3}{##4}}%
+ \fi
+ \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}%
@@ -286,35 +478,25 @@
\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}
+ \def\process@language##1##2##3{%
+ \def\process@line####1####2 ####3 ####4 {}}}
\AddBabelHook{luatex}{loadpatterns}{%
- \ifnum0=\directlua{tex.sprint(processnow and "0" or "1")}\relax
- \input #1\relax
- \fi}
+ \input #1\relax
+ \expandafter\gdef\csname bbl@hyphendata@\the\language\endcsname
+ {{#1}{}}}
\AddBabelHook{luatex}{loadexceptions}{%
- \ifnum0=\directlua{tex.sprint(processnow and "0" or "1")}\relax
- \input #1\relax
- \fi
- \directlua{processnow = nil}}
+ \input #1\relax
+ \def\bbl@tempb##1##2{{##1}{#1}}%
+ \expandafter\xdef\csname bbl@hyphendata@\the\language\endcsname
+ {\expandafter\expandafter\expandafter\bbl@tempb
+ \csname bbl@hyphendata@\the\language\endcsname}}
% \end{macrocode}
%
% \begin{macro}{\babelpatterns}
%
% This macro adds patterns. Two macros are used to store them:
-% |\bbl@patterns@| for the global ones and |\bbl@patterns<lang>|
+% |\bbl@patterns@| for the global ones and |\bbl@patterns@<lang>|
% for language ones. We make sure there is a space between words
% when multiple commands are used.
% \changes{bbunicode~1.0e}{2015/07/26}{Macro \cs{babelpatterns} added}