From 2d5aaeac9797374ab4ba49d579116893e1e949a3 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 3 Aug 2015 22:05:09 +0000 Subject: babel (3aug15) git-svn-id: svn://tug.org/texlive/trunk@38036 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/babel/README | 14 ++- Master/texmf-dist/doc/latex/babel/babel.pdf | Bin 388311 -> 390656 bytes Master/texmf-dist/source/latex/babel/babel.dtx | 59 +++++++--- Master/texmf-dist/source/latex/babel/bbunicode.dtx | 120 ++++++++++++++++++--- Master/texmf-dist/tex/generic/babel/babel.def | 8 +- Master/texmf-dist/tex/generic/babel/babel.sty | 7 +- Master/texmf-dist/tex/generic/babel/blplain.tex | 2 +- Master/texmf-dist/tex/generic/babel/bplain.tex | 2 +- Master/texmf-dist/tex/generic/babel/hyphen.cfg | 6 +- Master/texmf-dist/tex/generic/babel/luababel.def | 97 ++++++++++++++--- Master/texmf-dist/tex/generic/babel/nil.ldf | 4 +- Master/texmf-dist/tex/generic/babel/plain.def | 2 +- Master/texmf-dist/tex/generic/babel/switch.def | 10 +- 13 files changed, 267 insertions(+), 64 deletions(-) diff --git a/Master/texmf-dist/doc/latex/babel/README b/Master/texmf-dist/doc/latex/babel/README index 1053af468af..e28de7994e3 100644 --- a/Master/texmf-dist/doc/latex/babel/README +++ b/Master/texmf-dist/doc/latex/babel/README @@ -1,7 +1,7 @@ -Babel 3.9l +Babel 3.9m ---------- -This is Babel 3.9l. +This is Babel 3.9m. Version 3.9a fixed lots of bugs and added some new features, intended mainly to make it compatible somehow with Unicode engines. Some bugs @@ -87,16 +87,22 @@ New - Removed the luatex stuff for shorthands. It was just a first step, but ended up in the final release of 3.9i (it shouldn't). - Improvements for Plain and other non-LaTeX formats. -3.9l - Formerly, fontspec set \latinencoding to EUx i babel was loaded. +3.9l - Formerly, fontspec set \latinencoding to EUx if babel was loaded. Now, babel sets it if fontspec is loaded. - New package options 'nocase' (\SetCase is ignored) and 'silent' - Improved compatibility (hopefully) with babelbib. +3.9m - Fixed melayu name (from meyalu) + - A few lines for \babelpatterns (only luatex, see below) + * bbunicode.dtx 1.0b - Improvements by Elie Roux for LuaTeX. 1.0c - Bug fix. A few codes in xetex where wrong when loading patterns. +1.0e - \babelpatterns, which adds patterns to a language. + - Use [[]] instead of \luaescapestring (the latter is not always + available). ------------ Javier Bezos -2014-09-25 +2015-08-03 diff --git a/Master/texmf-dist/doc/latex/babel/babel.pdf b/Master/texmf-dist/doc/latex/babel/babel.pdf index 6208c1dcac6..75bc5d50130 100644 Binary files a/Master/texmf-dist/doc/latex/babel/babel.pdf and b/Master/texmf-dist/doc/latex/babel/babel.pdf differ diff --git a/Master/texmf-dist/source/latex/babel/babel.dtx b/Master/texmf-dist/source/latex/babel/babel.dtx index 236d513ef3c..d37a62decf5 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}[2014/09/25 v3.9l The Babel package] +%%\ProvidesFile{babel.dtx}[2015/08/03 v3.9m The Babel package] %\iffalse % % Babel DOCUMENT-STYLE option for LaTeX version 2.09 or plain TeX; @@ -196,8 +196,8 @@ \vspace{2cm}\hspace{1.5cm} \begin{minipage}{5cm} \Large -Version 3.9l\newline -2014/09/25 +Version 3.9m\newline +2015/08/03 \vspace{1cm} \textit{Original author}\newline @@ -733,6 +733,8 @@ in \textsf{english} the shorthands defined by \textsf{ngerman} with \begin{verbatim} \addto\extrasenglish{\languageshorthands{ngerman}} \end{verbatim} +(You may also need to activate them with, for example, +|\useshorthands|.) Very often, this is a more convenient way to deactivate shorthands than |\shorthandoff|, as for example if you want to define a macro @@ -839,7 +841,8 @@ option with the value |normal| they are deactivated in math mode a shorthand) are not a source of trouble any more. \Describe{config=}{\meta{file}} Load \meta{file}\texttt{.cfg} instead -of the default config file |bblopts.cfg|. +of the default config file |bblopts.cfg| (the file is loaded even +with |noconfigs|). \Describe{main=}{\meta{language}} Sets the main language, as explained above, ie, this language is always loaded last. If it is not given as @@ -861,7 +864,7 @@ loaded when the format was created: number (remember dialects can share it), name, hyphenation file and exceptions file. \Describe{nocase}{} \New{3.9l} Language settings for uppercase and -lowercase mapping (as set by |\SetCase|) is ignored. Use only if there +lowercase mapping (as set by |\SetCase|) are ignored. Use only if there are incompatibilities with other packages. \Describe{silent}{} \New{3.9l} No warnings and no \textit{infos} are @@ -1111,6 +1114,27 @@ Listed words are saved expanded and therefore it relies on the LICR. Of course, it also works without the LICR if the input and the font encodings are the same, like in Unicode based engines. +\Describe\babelpatterns{\texttt{[}\langlist\texttt{]}%^^A + \marg{patterns}} + +\New{3.9m} \textit{In \textsf{luatex} only},\footnote{With +\textsf{luatex} exceptions and patterns can be modified almost +freely. However, this is very likely a task for a separate package +and \texttt{babel} only provides the most basic tools.} adds or +replaces patterns for the languages given or, without the optional +argument, for \textit{all} languages. If a pattern for a certain +combination already exists, it gets replaced by the new one. + +It can be used only in the preamble, and patterns are added when the +language is first selected, thus taking into account changes of +|\lccodes|'s done in |\extras|\m{lang} as well as the language specific +encoding (not set in the preamble by default). Multiple +|\babelpatterns|'s are allowed. + +Listed patterns are saved expanded and therefore it relies on the +LICR. Of course, it also works without the LICR if the input and the +font encodings are the same, like in Unicode based engines. + \subsection{Language attributes} \DescribeMacro{\languageattribute} @@ -1143,7 +1167,7 @@ current options may be different. \sffamily \item[Afrikaans] afrikaans \item[Bahasa] bahasa, indonesian, indon, bahasai, - bahasam, malay, meyalu + bahasam, malay, melayu \item[Basque] basque \item[Breton] breton \item[Bulgarian] bulgarian @@ -1596,7 +1620,7 @@ explained in in sec. \ref{s:strings} (\babel{} 3.9 and later). \begin{verbatim} \ProvidesLanguage{} - [2014/09/25 v0.0 support from the babel system] + [2015/08/03 v0.0 support from the babel system] \LdfInit{}{captions} \ifx\undefined\l@ @@ -1712,7 +1736,7 @@ instance, be used in adding instructions to a macro like Be careful when using this macro, because depending on the case the assignment could be either global (usually) or local (sometimes). That -does not seems very consistent, but this behaviour is preserved for +does not seem very consistent, but this behaviour is preserved for backward compatibility. If you are using \pkg{etoolbox}, by Philipp Lehman, consider using the tools provided by this package instead of |\addto|. @@ -2367,7 +2391,7 @@ help from Bernd Raichle, for which I am grateful. % \file{babel.def} and provides a few tools for Plain. % \item[hyphen.cfg] is the file to be used when generating the % formats to load hyphenation patterns. By default it also loads -% \file{suçwitch.def}. +% \file{switch.def}. % \end{description} % % The \babel{} installer extends \textsf{docstrip} with a few @@ -2378,8 +2402,8 @@ help from Bernd Raichle, for which I am grateful. % little bit of literate programming. % % \begin{macrocode} -%<> -%<> +%<> +%<> % \end{macrocode} % % We define some basic macros which just make the code cleaner. @@ -2844,7 +2868,7 @@ help from Bernd Raichle, for which I am grateful. % \changes{babel~3.8h}{2005/11/23}{added synonyms \Lopt{indonesian}, % \Lopt{indon} and \Lopt{bahasai} for the original bahasa % (indonesia) support} -% \changes{babel~3.8h}{2005/11/23}{added \Lopt{malay}, \Lopt{meyaluy} +% \changes{babel~3.8h}{2005/11/23}{added \Lopt{malay}, \Lopt{meyalu} % and \Lopt{bahasam} for the Bahasa Malaysia support} % \changes{babel~3.5b}{1995/05/25}{Added \Lopt{brazilian} as % alternative for \Lopt{brazil}} @@ -2880,6 +2904,8 @@ help from Bernd Raichle, for which I am grateful. % \Lopt{USenglish}} % \changes{babel~3.9i}{2014/03/01}{Removed German options, because % they are now loaded directly} +% \changes{babel~3.9m}{2015/07/28}{Added melayu (meyalu preserved for +% compatibility)} % % Languages are loaded when processing the corresponding option % \textit{except} if a |main| language has been set. In such a @@ -2930,6 +2956,7 @@ help from Bernd Raichle, for which I am grateful. \DeclareOption{lowersorbian}{\bbl@load@language{lsorbian}} \DeclareOption{malay}{\bbl@load@language{bahasam}} \DeclareOption{meyalu}{\bbl@load@language{bahasam}} +\DeclareOption{melayu}{\bbl@load@language{bahasam}} \DeclareOption{newzealand}{\bbl@load@language{english}} \DeclareOption{nynorsk}{\bbl@load@language{norsk}} \DeclareOption{polutonikogreek}{% @@ -4794,7 +4821,7 @@ help from Bernd Raichle, for which I am grateful. \ifx\bbl@hyphlist\@empty\else \bbl@warning{% You must not intermingle \string\selectlanguage\space and\\% - \string\babelhyphenation\space or some exception will not\\% + \string\babelhyphenation\space or some exceptions will not\\% be taken into account. Reported}% \fi \ifx\@empty#1% @@ -6584,7 +6611,7 @@ 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.} % \begin{macrocode} \AtBeginDocument{% \@ifpackageloaded{fontspec}% @@ -7540,6 +7567,8 @@ help from Bernd Raichle, for which I am grateful. % \changes{babel~3.8l}{2008/07/06}{Macro added} % \changes{babel~3.9a}{2012/08/28}{Extended to set hyphenation % exceptions as defined with \cs{babelhyphenation}} +% \changes{babel~3.9m}{2015/07/25}{Preset \cs{bbl@pttnlist} and +% \cs{bbl@patterns@} to relax, for luatex.} % This macro selects the hyphenation patterns by changing the % \cs{language} register. If special hyphenation patterns % are available specifically for the current font encoding, @@ -7556,6 +7585,8 @@ help from Bernd Raichle, for which I am grateful. % \begin{macrocode} \let\bbl@hyphlist\@empty \let\bbl@hyphenation@\relax +\let\bbl@pttnlist\@empty +\let\bbl@patterns@\relax \let\bbl@hymapsel=\@cclv \def\bbl@patterns#1{% \language=\expandafter\ifx\csname l@#1:\f@encoding\endcsname\relax diff --git a/Master/texmf-dist/source/latex/babel/bbunicode.dtx b/Master/texmf-dist/source/latex/babel/bbunicode.dtx index ce94a0cea59..bcbc4792840 100644 --- a/Master/texmf-dist/source/latex/babel/bbunicode.dtx +++ b/Master/texmf-dist/source/latex/babel/bbunicode.dtx @@ -31,7 +31,7 @@ % \iffalse %<*dtx> \ProvidesFile{bbunicode.dtx} - [2014/03/21 v1.0d Babel hooks for Unicode engines] + [2015/05/10 v1.0e Babel hooks for Unicode engines] % % %% File `bbunicode.dtx' @@ -187,10 +187,19 @@ % letter or other} % \changes{bbunicode~1.0d}{2014/03/21}{Removed the `misfeature' for % `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.} % % \begin{macrocode} %<*luatex> -\directlua{% +\begingroup +\catcode`\%=12 +\catcode`\'=12 +\catcode`\"=12 +\catcode`\:=12 +\directlua{ require("luatex-hyphen") Babel = {} function Babel.bytes(line) @@ -199,7 +208,8 @@ end function Babel.begin_process_input() if luatexbase and luatexbase.add_to_callback then - luatexbase.add_to_callback('process_input_buffer',Babel.bytes,'Babel.bytes') + luatexbase.add_to_callback('process_input_buffer', + Babel.bytes,'Babel.bytes') else Babel.callback = callback.find('process_input_buffer') callback.register('process_input_buffer',Babel.bytes) @@ -212,7 +222,33 @@ callback.register('process_input_buffer',Babel.callback) end end + function Babel.addpatterns(pp, lg) + local lg = lang.new(lg) + local pats = lang.patterns(lg) or '' + lang.clear_patterns(lg) + for p in pp:gmatch('[^%s]+') do + ss = '' + for i in string.utfcharacters(p:gsub('%d', '')) do + ss = ss .. '%d?' .. i + end + ss = ss:gsub('^%%d%?%.', '%%.') .. '%d?' + ss = ss:gsub('%.%%d%?$', '%%.') + pats, n = pats:gsub('%s' .. ss .. '%s', ' ' .. p .. ' ') + if n == 0 then + tex.sprint( + [[\string\csname\space bbl@info\endcsname{New pattern: ]] + .. p .. [[}]]) + pats = pats .. ' ' .. p + else + tex.sprint( + [[\string\csname\space bbl@info\endcsname{Renew pattern: ]] + .. p .. [[}]]) + end + end + lang.patterns(lg, pats) + end } +\endgroup \def\BabelStringsDefault{unicode} \let\luabbl@stop\relax \AddBabelHook{luatex}{encodedcommands}{% @@ -226,25 +262,39 @@ \luabbl@stop \let\luabbl@stop\relax} \AddBabelHook{luatex}{patterns}{% - \ifx\directlua\relax\else - \ifcsname lu@texhyphen@loaded@\the\language\endcsname \else - \global\@namedef{lu@texhyphen@loaded@\the\language}{}% - \directlua{ - luatexhyphen.loadlanguage('\luatexluaescapestring{\string#1}', - '\the\language')}% - \fi - \fi} + \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@patterns@}{}{% + \begingroup + \@expandtwoargs\in@{,\number\language,}{,\bbl@pttnlist}% + \ifin@\else + \ifx\bbl@patterns@\@empty\else + \directlua{ Babel.addpatterns( + [[\bbl@patterns@]], \number\language) }% + \fi + \@ifundefined{bbl@patterns@#1}% + \@empty + {\directlua{ Babel.addpatterns( + [[\space\csname bbl@patterns@#1\endcsname]], + \number\language) }}% + \xdef\bbl@pttnlist{\bbl@pttnlist\number\language,}% + \fi + \endgroup}} \AddBabelHook{luatex}{adddialect}{% \ifx\directlua\relax\else \directlua{ - luatexhyphen.adddialect('\luatexluaescapestring{\string#1}', - '\luatexluaescapestring{\string#2}') + luatexhyphen.adddialect([[\string#1]], + [[\string#2]]) }% \fi} \AddBabelHook{luatex}{everylanguage}{% \directlua{ processnow = (tex.language == 0) or - (luatexhyphen.lookupname('\luatexluaescapestring{\string#1}') == nil)}% + (luatexhyphen.lookupname([[\string#1]]) == nil)}% \ifnum0=\directlua{tex.sprint(processnow and "0" or "1")}\relax \global\@namedef{lu@texhyphen@loaded@\the\language}{}% \fi} @@ -257,6 +307,48 @@ \input #1\relax \fi \directlua{processnow = nil}} +% \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| +% 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} +% +% \begin{macrocode} +\@onlypreamble\babelpatterns +\AtEndOfPackage{% + \newcommand\babelpatterns[2][\@empty]{% + \ifx\bbl@patterns@\relax + \let\bbl@patterns@\@empty + \fi + \ifx\bbl@pttnlist\@empty\else + \bbl@warning{% + You must not intermingle \string\selectlanguage\space and\\% + \string\babelpatterns\space or some patterns will not\\% + be taken into account. Reported}% + \fi + \ifx\@empty#1% + \protected@edef\bbl@patterns@{\bbl@patterns@\space#2}% + \else + \edef\bbl@tempb{\zap@space#1 \@empty}% + \bbl@for\bbl@tempa\bbl@tempb{% + \bbl@fixname\bbl@tempa + \bbl@iflanguage\bbl@tempa{% + \bbl@csarg\protected@edef{patterns@\bbl@tempa}{% + \@ifundefined{bbl@patterns@\bbl@tempa}% + \@empty + {\csname bbl@patterns@\bbl@tempa\endcsname\space}% + #2}}}% + \fi}} +% \end{macrocode} +% \end{macro} +% +% Common stuff. +% +% \begin{macrocode} <@Restore Unicode catcodes before loading patterns@> <@Font selection@> % diff --git a/Master/texmf-dist/tex/generic/babel/babel.def b/Master/texmf-dist/tex/generic/babel/babel.def index ed3232d161b..3d32f7e8f1b 100644 --- a/Master/texmf-dist/tex/generic/babel/babel.def +++ b/Master/texmf-dist/tex/generic/babel/babel.def @@ -38,7 +38,7 @@ %% and covered by LPPL is defined by the unpacking scripts (with %% extension .ins) which are part of the distribution. %% File 'babel.dtx' -%%\ProvidesFile{babel.dtx}[2014/09/25 v3.9l The Babel package] +%%\ProvidesFile{babel.dtx}[2015/08/03 v3.9m The Babel package] %% Babel package for LaTeX2e. %% Copyright (C) 1989-2008 by Johannes Braams, %% TeXniek @@ -56,11 +56,11 @@ \wlog{File: #1 #4 #3 <#2>}% \let\ProvidesFile\@undefined} \fi -\ProvidesFile{babel.def}[2014/09/25 3.9l Babel common definitions] +\ProvidesFile{babel.def}[2015/08/03 3.9m Babel common definitions] \ifx\AtBeginDocument\@undefined \input plain.def\relax \fi -\def\bbl@tempa{3.9l}% +\def\bbl@tempa{3.9m}% \ifx\bbl@version\bbl@tempa\else \input switch.def\relax \fi @@ -718,7 +718,7 @@ \ifx\bbl@hyphlist\@empty\else \bbl@warning{% You must not intermingle \string\selectlanguage\space and\\% - \string\babelhyphenation\space or some exception will not\\% + \string\babelhyphenation\space or some exceptions will not\\% be taken into account. Reported}% \fi \ifx\@empty#1% diff --git a/Master/texmf-dist/tex/generic/babel/babel.sty b/Master/texmf-dist/tex/generic/babel/babel.sty index bfe4259cda9..5de7c55e299 100644 --- a/Master/texmf-dist/tex/generic/babel/babel.sty +++ b/Master/texmf-dist/tex/generic/babel/babel.sty @@ -38,7 +38,7 @@ %% and covered by LPPL is defined by the unpacking scripts (with %% extension .ins) which are part of the distribution. %% File 'babel.dtx' -%%\ProvidesFile{babel.dtx}[2014/09/25 v3.9l The Babel package] +%%\ProvidesFile{babel.dtx}[2015/08/03 v3.9m The Babel package] %% Babel package for LaTeX2e. %% Copyright (C) 1989-2008 by Johannes Braams, %% TeXniek @@ -48,10 +48,10 @@ %% by Javier Bezos %% all rights reserved. \NeedsTeXFormat{LaTeX2e}[2005/12/01] -\ProvidesPackage{babel}[2014/09/25 3.9l The Babel package] +\ProvidesPackage{babel}[2015/08/03 3.9m The Babel package] \@ifpackagewith{babel}{debug} {\input switch.def\relax} - {\def\bbl@tempa{3.9l}% + {\def\bbl@tempa{3.9m}% \ifx\bbl@version\bbl@tempa\else \input switch.def\relax \fi} @@ -243,6 +243,7 @@ \DeclareOption{lowersorbian}{\bbl@load@language{lsorbian}} \DeclareOption{malay}{\bbl@load@language{bahasam}} \DeclareOption{meyalu}{\bbl@load@language{bahasam}} +\DeclareOption{melayu}{\bbl@load@language{bahasam}} \DeclareOption{newzealand}{\bbl@load@language{english}} \DeclareOption{nynorsk}{\bbl@load@language{norsk}} \DeclareOption{polutonikogreek}{% diff --git a/Master/texmf-dist/tex/generic/babel/blplain.tex b/Master/texmf-dist/tex/generic/babel/blplain.tex index d80d8ee843d..948340c523b 100644 --- a/Master/texmf-dist/tex/generic/babel/blplain.tex +++ b/Master/texmf-dist/tex/generic/babel/blplain.tex @@ -38,7 +38,7 @@ %% and covered by LPPL is defined by the unpacking scripts (with %% extension .ins) which are part of the distribution. %% File 'babel.dtx' -%%\ProvidesFile{babel.dtx}[2014/09/25 v3.9l The Babel package] +%%\ProvidesFile{babel.dtx}[2015/08/03 v3.9m The Babel package] %% Babel package for LaTeX2e. %% Copyright (C) 1989-2008 by Johannes Braams, %% TeXniek diff --git a/Master/texmf-dist/tex/generic/babel/bplain.tex b/Master/texmf-dist/tex/generic/babel/bplain.tex index 63f66c12e44..a38632250f1 100644 --- a/Master/texmf-dist/tex/generic/babel/bplain.tex +++ b/Master/texmf-dist/tex/generic/babel/bplain.tex @@ -38,7 +38,7 @@ %% and covered by LPPL is defined by the unpacking scripts (with %% extension .ins) which are part of the distribution. %% File 'babel.dtx' -%%\ProvidesFile{babel.dtx}[2014/09/25 v3.9l The Babel package] +%%\ProvidesFile{babel.dtx}[2015/08/03 v3.9m The Babel package] %% Babel package for LaTeX2e. %% Copyright (C) 1989-2008 by Johannes Braams, %% TeXniek diff --git a/Master/texmf-dist/tex/generic/babel/hyphen.cfg b/Master/texmf-dist/tex/generic/babel/hyphen.cfg index 3e4021001b1..238c31a0437 100644 --- a/Master/texmf-dist/tex/generic/babel/hyphen.cfg +++ b/Master/texmf-dist/tex/generic/babel/hyphen.cfg @@ -38,7 +38,7 @@ %% and covered by LPPL is defined by the unpacking scripts (with %% extension .ins) which are part of the distribution. %% File 'babel.dtx' -%%\ProvidesFile{babel.dtx}[2014/09/25 v3.9l The Babel package] +%%\ProvidesFile{babel.dtx}[2015/08/03 v3.9m The Babel package] %% Babel package for LaTeX2e. %% Copyright (C) 1989-2008 by Johannes Braams, %% TeXniek @@ -52,7 +52,7 @@ \wlog{File: #1 #4 #3 <#2>}% \let\ProvidesFile\@undefined} \fi -\ProvidesFile{hyphen.cfg}[2014/09/25 3.9l Babel hyphens] +\ProvidesFile{hyphen.cfg}[2015/08/03 3.9m Babel hyphens] \xdef\bbl@format{\jobname} \ifx\AtBeginDocument\@undefined \def\@empty{} @@ -83,7 +83,7 @@ \countdef\last@language=19 \def\addlanguage{\alloc@9\language\chardef\@cclvi} \fi -\toks8{Babel <3.9l> and hyphenation patterns for }% +\toks8{Babel <3.9m> and hyphenation patterns for }% \def\process@line#1#2 #3 #4 {% \ifx=#1% \process@synonym{#2}% diff --git a/Master/texmf-dist/tex/generic/babel/luababel.def b/Master/texmf-dist/tex/generic/babel/luababel.def index 0eeedc14690..dc8f155e23d 100644 --- a/Master/texmf-dist/tex/generic/babel/luababel.def +++ b/Master/texmf-dist/tex/generic/babel/luababel.def @@ -41,7 +41,12 @@ %% Babel package for LaTeX version 2e %% Copyright (C) 2103-2014 %% by Javier Bezos -\directlua{% +\begingroup +\catcode`\%=12 +\catcode`\'=12 +\catcode`\"=12 +\catcode`\:=12 +\directlua{ require("luatex-hyphen") Babel = {} function Babel.bytes(line) @@ -50,7 +55,8 @@ end function Babel.begin_process_input() if luatexbase and luatexbase.add_to_callback then - luatexbase.add_to_callback('process_input_buffer',Babel.bytes,'Babel.bytes') + luatexbase.add_to_callback('process_input_buffer', + Babel.bytes,'Babel.bytes') else Babel.callback = callback.find('process_input_buffer') callback.register('process_input_buffer',Babel.bytes) @@ -63,7 +69,33 @@ callback.register('process_input_buffer',Babel.callback) end end + function Babel.addpatterns(pp, lg) + local lg = lang.new(lg) + local pats = lang.patterns(lg) or '' + lang.clear_patterns(lg) + for p in pp:gmatch('[^%s]+') do + ss = '' + for i in string.utfcharacters(p:gsub('%d', '')) do + ss = ss .. '%d?' .. i + end + ss = ss:gsub('^%%d%?%.', '%%.') .. '%d?' + ss = ss:gsub('%.%%d%?$', '%%.') + pats, n = pats:gsub('%s' .. ss .. '%s', ' ' .. p .. ' ') + if n == 0 then + tex.sprint( + [[\string\csname\space bbl@info\endcsname{New pattern: ]] + .. p .. [[}]]) + pats = pats .. ' ' .. p + else + tex.sprint( + [[\string\csname\space bbl@info\endcsname{Renew pattern: ]] + .. p .. [[}]]) + end + end + lang.patterns(lg, pats) + end } +\endgroup \def\BabelStringsDefault{unicode} \let\luabbl@stop\relax \AddBabelHook{luatex}{encodedcommands}{% @@ -77,25 +109,39 @@ \luabbl@stop \let\luabbl@stop\relax} \AddBabelHook{luatex}{patterns}{% - \ifx\directlua\relax\else - \ifcsname lu@texhyphen@loaded@\the\language\endcsname \else - \global\@namedef{lu@texhyphen@loaded@\the\language}{}% - \directlua{ - luatexhyphen.loadlanguage('\luatexluaescapestring{\string#1}', - '\the\language')}% - \fi - \fi} + \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@patterns@}{}{% + \begingroup + \@expandtwoargs\in@{,\number\language,}{,\bbl@pttnlist}% + \ifin@\else + \ifx\bbl@patterns@\@empty\else + \directlua{ Babel.addpatterns( + [[\bbl@patterns@]], \number\language) }% + \fi + \@ifundefined{bbl@patterns@#1}% + \@empty + {\directlua{ Babel.addpatterns( + [[\space\csname bbl@patterns@#1\endcsname]], + \number\language) }}% + \xdef\bbl@pttnlist{\bbl@pttnlist\number\language,}% + \fi + \endgroup}} \AddBabelHook{luatex}{adddialect}{% \ifx\directlua\relax\else \directlua{ - luatexhyphen.adddialect('\luatexluaescapestring{\string#1}', - '\luatexluaescapestring{\string#2}') + luatexhyphen.adddialect([[\string#1]], + [[\string#2]]) }% \fi} \AddBabelHook{luatex}{everylanguage}{% \directlua{ processnow = (tex.language == 0) or - (luatexhyphen.lookupname('\luatexluaescapestring{\string#1}') == nil)}% + (luatexhyphen.lookupname([[\string#1]]) == nil)}% \ifnum0=\directlua{tex.sprint(processnow and "0" or "1")}\relax \global\@namedef{lu@texhyphen@loaded@\the\language}{}% \fi} @@ -108,6 +154,31 @@ \input #1\relax \fi \directlua{processnow = nil}} +\@onlypreamble\babelpatterns +\AtEndOfPackage{% + \newcommand\babelpatterns[2][\@empty]{% + \ifx\bbl@patterns@\relax + \let\bbl@patterns@\@empty + \fi + \ifx\bbl@pttnlist\@empty\else + \bbl@warning{% + You must not intermingle \string\selectlanguage\space and\\% + \string\babelpatterns\space or some patterns will not\\% + be taken into account. Reported}% + \fi + \ifx\@empty#1% + \protected@edef\bbl@patterns@{\bbl@patterns@\space#2}% + \else + \edef\bbl@tempb{\zap@space#1 \@empty}% + \bbl@for\bbl@tempa\bbl@tempb{% + \bbl@fixname\bbl@tempa + \bbl@iflanguage\bbl@tempa{% + \bbl@csarg\protected@edef{patterns@\bbl@tempa}{% + \@ifundefined{bbl@patterns@\bbl@tempa}% + \@empty + {\csname bbl@patterns@\bbl@tempa\endcsname\space}% + #2}}}% + \fi}} \AddBabelHook{xetex}{loadkernel}{% \begingroup % Reset chars "80-"C0 to category "other", no case mapping: diff --git a/Master/texmf-dist/tex/generic/babel/nil.ldf b/Master/texmf-dist/tex/generic/babel/nil.ldf index 5179b3e8612..edddba78010 100644 --- a/Master/texmf-dist/tex/generic/babel/nil.ldf +++ b/Master/texmf-dist/tex/generic/babel/nil.ldf @@ -38,7 +38,7 @@ %% and covered by LPPL is defined by the unpacking scripts (with %% extension .ins) which are part of the distribution. %% File 'babel.dtx' -%%\ProvidesFile{babel.dtx}[2014/09/25 v3.9l The Babel package] +%%\ProvidesFile{babel.dtx}[2015/08/03 v3.9m The Babel package] %% Babel package for LaTeX2e. %% Copyright (C) 1989-2008 by Johannes Braams, %% TeXniek @@ -47,7 +47,7 @@ %% TeXniek %% by Javier Bezos %% all rights reserved. -\ProvidesLanguage{nil}[2014/09/25 3.9l Nil language] +\ProvidesLanguage{nil}[2015/08/03 3.9m Nil language] \LdfInit{nil}{datenil} \ifx\l@nohyphenation\@undefined \@nopatterns{nil} diff --git a/Master/texmf-dist/tex/generic/babel/plain.def b/Master/texmf-dist/tex/generic/babel/plain.def index 86615c7fb27..7f2889efd9b 100644 --- a/Master/texmf-dist/tex/generic/babel/plain.def +++ b/Master/texmf-dist/tex/generic/babel/plain.def @@ -38,7 +38,7 @@ %% and covered by LPPL is defined by the unpacking scripts (with %% extension .ins) which are part of the distribution. %% File 'babel.dtx' -%%\ProvidesFile{babel.dtx}[2014/09/25 v3.9l The Babel package] +%%\ProvidesFile{babel.dtx}[2015/08/03 v3.9m The Babel package] %% Babel package for LaTeX2e. %% Copyright (C) 1989-2008 by Johannes Braams, %% TeXniek diff --git a/Master/texmf-dist/tex/generic/babel/switch.def b/Master/texmf-dist/tex/generic/babel/switch.def index 0e5654ea15a..5f26d4dadfd 100644 --- a/Master/texmf-dist/tex/generic/babel/switch.def +++ b/Master/texmf-dist/tex/generic/babel/switch.def @@ -38,7 +38,7 @@ %% and covered by LPPL is defined by the unpacking scripts (with %% extension .ins) which are part of the distribution. %% File 'babel.dtx' -%%\ProvidesFile{babel.dtx}[2014/09/25 v3.9l The Babel package] +%%\ProvidesFile{babel.dtx}[2015/08/03 v3.9m The Babel package] %% Babel package for LaTeX2e. %% Copyright (C) 1989-2008 by Johannes Braams, %% TeXniek @@ -52,7 +52,7 @@ \wlog{File: #1 #4 #3 <#2>}% \let\ProvidesFile\@undefined} \fi -\ProvidesFile{switch.def}[2014/09/25 3.9l Babel switching mechanism] +\ProvidesFile{switch.def}[2015/08/03 3.9m Babel switching mechanism] \ifx\AtBeginDocument\@undefined \input plain.def\relax \fi @@ -73,8 +73,8 @@ \countdef\last@language=19 \def\addlanguage{\alloc@9\language\chardef\@cclvi} \fi -\def\bbl@version{3.9l} -\def\bbl@date{2014/09/25} +\def\bbl@version{3.9m} +\def\bbl@date{2015/08/03} \def\adddialect#1#2{% \global\chardef#1#2\relax \bbl@usehooks{adddialect}{{#1}{#2}}% @@ -240,6 +240,8 @@ \expandafter\bbl@switch\expandafter{\languagename}}} \let\bbl@hyphlist\@empty \let\bbl@hyphenation@\relax +\let\bbl@pttnlist\@empty +\let\bbl@patterns@\relax \let\bbl@hymapsel=\@cclv \def\bbl@patterns#1{% \language=\expandafter\ifx\csname l@#1:\f@encoding\endcsname\relax -- cgit v1.2.3