[latex3-commits] [latex2e-public] r1447 - Updated to 3.9r
noreply at latex-project.org
noreply at latex-project.org
Fri Apr 7 19:03:53 CEST 2017
Author: javier
Date: 2017-04-07 19:03:52 +0200 (Fri, 07 Apr 2017)
New Revision: 1447
Modified:
trunk/required/babel/README
trunk/required/babel/babel.dtx
trunk/required/babel/babel.ins
trunk/required/babel/babel.pdf
trunk/required/babel/bbcompat.dtx
trunk/required/babel/bbunicode.dtx
Log:
Updated to 3.9r
Modified: trunk/required/babel/README
===================================================================
--- trunk/required/babel/README 2017-04-05 20:29:46 UTC (rev 1446)
+++ trunk/required/babel/README 2017-04-07 17:03:52 UTC (rev 1447)
@@ -1,10 +1,11 @@
-Babel 3.9o
+Babel 3.9r
----------
-This is Babel 3.9o.
+This is Babel 3.9r.
-**** If you are upgrading to 3.9o and want to use luatex, ****
-**** you must rebuild the formats ****
+*** Babel 3.9o and 3.9p are deprecated ***
+*** For incompatibilities with polyglossia read the manual ***
+*** You must recreate the formats if coming from an older version ***
Version 3.9a fixed lots of bugs and added some new features, intended
mainly to make it compatible somehow with Unicode engines. Some bugs
@@ -98,6 +99,13 @@
- A few lines for \babelpatterns (only luatex, see below).
3.9n - Just fixes a couple of minor bugs (related to 2.09 and ifthen).
3.9o - Adapted to the forthcoming Unicode encoding.
+3.9p - A little change for bbunicode 1.1b.
+3.9q - base now reads patterns in lua
+ - Some minor changes for luatex
+3.9r - The three main dtx files now share version numbers.
+ - bbunicode - Fixed a line break at \cs{foreignlanguage} with
+ unloaded patterns. Also added \babelcatcodetablenum, just in
+ case.
* bbunicode.dtx
1.0b - Improvements by Elie Roux for LuaTeX.
@@ -107,8 +115,12 @@
available).
1.0f - Code for luatex assigned mistakenly to xetex.
1.1a - Revamped hyphenation loader for luatex.
-
+1.1b - Now patterns are loaded with lua(e)tex (and a bug fixed).
+1.1c - Patterns loader thorougly revised
+3.9r and later - The three main dtx files now share version numbers. See
+ changes above
+
------------
Javier Bezos
-2016-02-01
+2016-04-23
Modified: trunk/required/babel/babel.dtx
===================================================================
--- trunk/required/babel/babel.dtx 2017-04-05 20:29:46 UTC (rev 1446)
+++ trunk/required/babel/babel.dtx 2017-04-07 17:03:52 UTC (rev 1447)
@@ -36,7 +36,7 @@
%\iffalse
%% File 'babel.dtx'
%\fi
-%%\ProvidesFile{babel.dtx}[2016/02/01 v3.9o The Babel package]
+%%\ProvidesFile{babel.dtx}[2016/04/23 v3.9r 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.9o\newline
-2016/02/01
+Version 3.9r\newline
+2016/04/23
\vspace{1cm}
\textit{Original author}\newline
@@ -1291,9 +1291,6 @@
|"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
@@ -1378,17 +1375,34 @@
distribution, so please, read the documentation for the latter (note
also some distributions generate the file with some tool).
-\New{3.9o} With \luatex, however, patterns are loaded on the fly when
-requested by the language (except the ``0th'' language,
-\textsf{english}, which is preloaded always). 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).
+\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
@@ -1636,7 +1650,7 @@
\begin{verbatim}
\ProvidesLanguage{<language>}
- [0000/00/00 v0.0 <Language> support from the babel system]
+ [2016/04/23 v0.0 <Language> support from the babel system]
\LdfInit{<language>}{captions<language>}
\ifx\undefined\l@<language>
@@ -2419,8 +2433,8 @@
% little bit of literate programming.
%
% \begin{macrocode}
-%<<version=3.9o>>
-%<<date=2016/02/01>>
+%<<version=3.9r>>
+%<<date=2016/04/23>>
% \end{macrocode}
%
% We define some basic macros which just make the code cleaner.
@@ -2450,9 +2464,9 @@
%<</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>>
@@ -2464,9 +2478,9 @@
%<</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>>
@@ -2477,6 +2491,19 @@
%<</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 at 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}.
%
@@ -2625,6 +2652,8 @@
% 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]
@@ -2632,12 +2661,46 @@
\@ifpackagewith{babel}{debug}
{\input switch.def\relax}
{<@Load switch if newer@>}
+<@Load patterns in luatex@>
<@Basic macros@>
\def\AfterBabelLanguage#1{%
\global\expandafter\bbl at add\csname#1.ldf-h@@k\endcsname}%
+% \end{macrocode}
+% If the format created a list of loaded languages (in
+% |\bbl at languages|), get the name of the 0-th to show the actual
+% language used.
+% \begin{macrocode}
+\ifx\bbl at languages\@undefined\else
+ \begingroup
+ \catcode`\^^I=12
+ \@ifpackagewith{babel}{showlanguages}{%
+ \begingroup
+ \def\bbl at elt#1#2#3#4{\wlog{#2^^I#1^^I#3^^I#4}}%
+ \wlog{<*languages>}%
+ \bbl at languages
+ \wlog{</languages>}%
+ \endgroup}{}
+ \endgroup
+ \def\bbl at elt#1#2#3#4{%
+ \ifnum#2=\z@
+ \gdef\bbl at nulllanguage{#1}%
+ \def\bbl at elt##1##2##3##4{}%
+ \fi}%
+ \bbl at 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 at patterns{\CurrentOption}}%
+ \ifx\directlua\@undefined
+ \DeclareOption*{\bbl at patterns{\CurrentOption}}%
+ \else
+ \DeclareOption*{\bbl at patterns@lua{\CurrentOption}}%
+ \fi
\DeclareOption{base}{}%
+ \DeclareOption{showlanguages}{}%
\ProcessOptions
\global\expandafter\let\csname opt at babel.sty\endcsname\relax
\global\expandafter\let\csname ver at babel.sty\endcsname\relax
@@ -2833,29 +2896,6 @@
\bbl at opt@main}
\fi
% \end{macrocode}
-% If the format created a list of loaded languages (in
-% |\bbl at languages|), get the name of the 0-th to show the actual
-% language used.
-% \begin{macrocode}
-\ifx\bbl at languages\@undefined\else
- \begingroup
- \catcode`\^^I=12
- \@ifpackagewith{babel}{showlanguages}{%
- \begingroup
- \def\bbl at elt#1#2#3#4{\wlog{#2^^I#1^^I#3^^I#4}}%
- \wlog{<*languages>}%
- \bbl at languages
- \wlog{</languages>}%
- \endgroup}{}
- \endgroup
- \def\bbl at elt#1#2#3#4{%
- \ifnum#2=\z@
- \gdef\bbl at nulllanguage{#1}%
- \def\bbl at elt##1##2##3##4{}%
- \fi}%
- \bbl at languages
-\fi
-% \end{macrocode}
%
% \subsection{Language options}
%
@@ -3179,6 +3219,8 @@
% \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>
@@ -3194,24 +3236,27 @@
\fi
<@Load switch if newer@>
\ifx\bbl at 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 at english\z@
\fi
+<@Load patterns in luatex@>
<@Basic macros@>
\def\bbl at csarg#1#2{\expandafter#1\csname bbl@#2\endcsname}%
\chardef\bbl at engine=%
@@ -8783,7 +8828,7 @@
\fi
\def\@testopt#1#2{%
\@ifnextchar[{#1}{#1[#2]}}
-\def\@protected at testopt#1{%%
+\def\@protected at testopt#1{%
\ifx\protect\@typeset at protect
\expandafter\@testopt
\else
Modified: trunk/required/babel/babel.ins
===================================================================
--- trunk/required/babel/babel.ins 2017-04-05 20:29:46 UTC (rev 1446)
+++ trunk/required/babel/babel.ins 2017-04-07 17:03:52 UTC (rev 1447)
@@ -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{2016/02/01}
+\def\filedate{2016/02/05}
\def\batchfile{babel.ins}
\input docstrip.tex
@@ -65,12 +57,12 @@
% <<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, but it's not used here. This is done in two
+% 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
-% previouly defined. Deeper nesting is not allowed.
+% previously defined. Deeper nesting is not allowed.
\def\replaceVar#1<@#2{%
#1%
Modified: trunk/required/babel/babel.pdf
===================================================================
(Binary files differ)
Modified: trunk/required/babel/bbcompat.dtx
===================================================================
--- trunk/required/babel/bbcompat.dtx 2017-04-05 20:29:46 UTC (rev 1446)
+++ trunk/required/babel/bbcompat.dtx 2017-04-07 17:03:52 UTC (rev 1447)
@@ -30,7 +30,7 @@
%
% \iffalse
%<*dtx>
-\ProvidesFile{bbcompat.dtx}[2013/07/28 v1.2l]
+\ProvidesFile{bbcompat.dtx}[2016/04/23 v3.9r]
%</dtx>
%
%% File 'bbcompat.dtx'
Modified: trunk/required/babel/bbunicode.dtx
===================================================================
--- trunk/required/babel/bbunicode.dtx 2017-04-05 20:29:46 UTC (rev 1446)
+++ trunk/required/babel/bbunicode.dtx 2017-04-07 17:03:52 UTC (rev 1447)
@@ -31,7 +31,7 @@
% \iffalse
%<*dtx>
\ProvidesFile{bbunicode.dtx}
- [2016/02/01 v1.1a Babel hooks for Unicode engines]
+ [2016/04/23 v3.9r Babel hooks for Unicode engines]
%</dtx>
%
%% File `bbunicode.dtx'
@@ -166,7 +166,7 @@
\ifx\bbl at tempa\@empty
\XeTeXinputencoding"bytes"%
\else
- \XeTeXinputencoding"#1"%
+ \XeTeXinputencoding"#1"%
\fi
\def\xebbl at stop{\XeTeXinputencoding"utf8"}}
\AddBabelHook{xetex}{stopcommands}{%
@@ -177,33 +177,85 @@
<@Font selection@>
%</xetex>
% \end{macrocode}
-% \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 |\bbl at get@enc| is defined. Then comes a
-% simplified version of the loader in |hyphen.cfg| (without the
-% hyphenmins stuff, which is under the direct control of \babel). A
-% language has been loaded if |bbl at hyphendata@<num>| exists. The names
-% |\l@<language>| are defined and take some value from the beginning
-% because all ldf files assume this for the corresponding language to be
-% considered valid. Of course, there is room for improvements.
-% \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 at 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.}
-% \changes{bbunicode~1.1a}{2016/01/26}{New hyphenation loader for luatex.}
+% \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.}
+% \changes{bbunicode~1.1d}{2016/4/22}{Lua: Fixed a line break at
+% \cs{foreignlanguage} with unloaded patterns. Added
+% \cs{babelcatcodetablenum}, just in case.}
%
% \begin{macrocode}
%<*luatex>
-\ifx\bbl at get@enc\@undefined
+\ifx\AddBabelHook\@undefined
+\begingroup
+ \toks@{}
+ \count@\z@ % 0=start, 1=0th, 2=normal
\def\bbl at process@line#1#2 #3 #4 {%
\ifx=#1%
\bbl at process@synonym{#2}%
@@ -211,36 +263,59 @@
\bbl at process@language{#1#2}{#3}{#4}%
\fi
\ignorespaces}
+ \def\bbl at manylang{%
+ \ifnum\bbl at last>\@ne
+ \bbl at info{Non-standard hyphenation setup}%
+ \fi
+ \let\bbl at manylang\relax}
\def\bbl at process@language#1#2#3{%
- \@ifundefined{l@#1}%
- {\expandafter\addlanguage\csname l@#1\endcsname
- \expandafter\language\csname l@#1\endcsname
- \let\bbl at elt\relax
- \edef\bbl at languages{%
- \bbl at languages\bbl at elt{#1}{\the\language}{#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 at last\allocationnumber
+ \bbl at manylang
+ \let\bbl at elt\relax
+ \xdef\bbl at languages{%
+ \bbl at languages\bbl at elt{#1}{\the\language}{#2}{#3}}%
+ \fi
+ \the\toks@
+ \toks@{}}
+ \def\bbl at process@synonym at aux#1#2{%
+ \global\expandafter\chardef\csname l@#1\endcsname#2\relax
+ \let\bbl at elt\relax
+ \xdef\bbl at languages{%
+ \bbl at languages\bbl at elt{#1}{#2}{}{}}}%
\def\bbl at process@synonym#1{%
- \@ifundefined{l@#1}%
- {\expandafter\chardef\csname l@#1\endcsname\last at language
- \let\bbl at elt\relax
- \edef\bbl at languages{%
- \bbl at languages\bbl at elt{#1}{\the\last at language}{}{}}}%
- {}}
- \ifnum\last at language>\z@
- \bbl at warning{Wrong or old hyphenation setup. Please, rebuild\\%
- the format. I'll try to fix it for this run.\\%
- Reported}%
- \def\bbl at elt#1#2#3#4{%
+ \ifcase\count@
+ \toks@\expandafter{\the\toks@\relax\bbl at process@synonym{#1}}%
+ \or
+ \@ifundefined{zth@#1}{\bbl at process@synonym at aux{#1}{0}}{}%
+ \else
+ \bbl at process@synonym at aux{#1}{\the\bbl at last}%
+ \fi}
+ \ifx\bbl at languages\@undefined % Just a (sensible?) guess
+ \chardef\l at english\z@
+ \chardef\l at USenglish\z@
+ \chardef\bbl at last\z@
+ \global\@namedef{bbl at hyphendata@0}{{hyphen.tex}{}}
+ \gdef\bbl at languages{%
+ \bbl at elt{english}{0}{hyphen.tex}{}%
+ \bbl at elt{USenglish}{0}{}{}}
+ \else
+ \global\let\bbl at languages@format\bbl at languages
+ \def\bbl at elt#1#2#3#4{% Remove all except language 0
\ifnum#2>\z@\else
\noexpand\bbl at elt{#1}{#2}{#3}{#4}%
\fi}%
- \edef\bbl at languages{\bbl at languages}%
+ \xdef\bbl at languages{\bbl at languages}%
\fi
- \ifnum\l at english=\z@\else
- \bbl at warning{Wrong hyphenation setup. The 0th language must\\%
- be `english'. Reported}%
- \fi
- \@namedef{bbl at hyphendata@0}{{hyphen.tex}{}}%
+ \def\bbl at elt#1#2#3#4{\@namedef{zth@#1}{}} % Define flags
+ \bbl at languages
\openin1=language.dat
\ifeof1
\bbl at warning{I couldn't find language.dat. No additional\\%
@@ -257,17 +332,62 @@
\fi
\repeat
\fi
- \def\bbl at get@enc#1:#2:#3\@@@{\def\bbl at hyph@enc{#2}}
- \def\bbl at luapatterns#1#2{%
- \bbl at get@enc#1::\@@@
+\endgroup
+\def\bbl at get@enc#1:#2:#3\@@@{\def\bbl at hyph@enc{#2}}
+\ifx\babelcatcodetablenum\@undefined
+ \def\babelcatcodetablenum{5211}
+\fi
+\def\bbl at luapatterns#1#2{%
+ \bbl at get@enc#1::\@@@
+ \setbox\z@\hbox\bgroup
\begingroup
+ \ifx\catcodetable\@undefined
+ \let\savecatcodetable\luatexsavecatcodetable
+ \let\initcatcodetable\luatexinitcatcodetable
+ \let\catcodetable\luatexcatcodetable
+ \fi
+ \savecatcodetable\babelcatcodetablenum\relax
+ \initcatcodetable\numexpr\babelcatcodetablenum+1\relax
+ \catcodetable\numexpr\babelcatcodetablenum+1\relax
+ \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
+ \catcodetable\babelcatcodetablenum\relax
\endgroup
\def\bbl at tempa{#2}%
\ifx\bbl at tempa\@empty\else
\input #2\relax
- \fi}%
-\fi
+ \fi
+ \egroup}%
+\def\bbl at patterns@lua#1{%
+ \language=\expandafter\ifx\csname l@#1:\f at encoding\endcsname\relax
+ \csname l@#1\endcsname
+ \edef\bbl at tempa{#1}%
+ \else
+ \csname l@#1:\f at encoding\endcsname
+ \edef\bbl at tempa{#1:\f at encoding}%
+ \fi\relax
+ \@namedef{lu at texhyphen@loaded@\the\language}{}% Temp
+ \@ifundefined{bbl at hyphendata@\the\language}%
+ {\def\bbl at elt##1##2##3##4{%
+ \ifnum##2=\csname l@\bbl at tempa\endcsname % #2=spanish, dutch:OT1...
+ \def\bbl at tempb{##3}%
+ \ifx\bbl at tempb\@empty\else % if not a synonymous
+ \def\bbl at tempc{{##3}{##4}}%
+ \fi
+ \bbl at csarg\xdef{hyphendata@##2}{\bbl at tempc}%
+ \fi}%
+ \bbl at languages
+ \@ifundefined{bbl at hyphendata@\the\language}%
+ {\bbl at info{No hyphenation patterns were set for\\%
+ language ‘\bbl at tempa’. Reported}}%
+ {\expandafter\expandafter\expandafter\bbl at luapatterns
+ \csname bbl at hyphendata@\the\language\endcsname}}{}}
+\endinput\fi
\begingroup
\catcode`\%=12
\catcode`\'=12
@@ -337,14 +457,12 @@
\AddBabelHook{luatex}{patterns}{%
\@ifundefined{bbl at hyphendata@\the\language}%
{\def\bbl at elt##1##2##3##4{%
- \def\bbl at tempa{##1}%
- \def\bbl at tempb{##3}%
- \ifx\bbl at tempb\@empty\else % if not synonymous
- \def\bbl at tempc{{##3}{##4}}%
- \fi
- \def\bbl at tempb{#2}% eg, spanish, dutch:OT1, etc.
- \ifx\bbl at tempa\bbl at tempb
- \bbl at csarg\edef{hyphendata@##2}{\bbl at tempc}%
+ \ifnum##2=\csname l@#2\endcsname % #2=spanish, dutch:OT1...
+ \def\bbl at tempb{##3}%
+ \ifx\bbl at tempb\@empty\else % if not a synonymous
+ \def\bbl at tempc{{##3}{##4}}%
+ \fi
+ \bbl at csarg\xdef{hyphendata@##2}{\bbl at tempc}%
\fi}%
\bbl at languages
\@ifundefined{bbl at hyphendata@\the\language}%
@@ -371,12 +489,22 @@
\AddBabelHook{luatex}{everylanguage}{%
\def\process at language##1##2##3{%
\def\process at line####1####2 ####3 ####4 {}}}
+\AddBabelHook{luatex}{loadpatterns}{%
+ \input #1\relax
+ \expandafter\gdef\csname bbl at hyphendata@\the\language\endcsname
+ {{#1}{}}}
+\AddBabelHook{luatex}{loadexceptions}{%
+ \input #1\relax
+ \def\bbl at tempb##1##2{{##1}{#1}}%
+ \expandafter\xdef\csname bbl at hyphendata@\the\language\endcsname
+ {\expandafter\expandafter\expandafter\bbl at tempb
+ \csname bbl at hyphendata@\the\language\endcsname}}
% \end{macrocode}
%
% \begin{macro}{\babelpatterns}
%
% This macro adds patterns. Two macros are used to store them:
-% |\bbl at patterns@| for the global ones and |\bbl at patterns<lang>|
+% |\bbl at patterns@| for the global ones and |\bbl at 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}
More information about the latex3-commits
mailing list