From fffd05cae905f23ad2300395a5ead86d7c0253cd Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 29 Nov 2021 21:13:12 +0000 Subject: babel (29nov21) git-svn-id: svn://tug.org/texlive/trunk@61186 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/babel/README.md | 11 +- Master/texmf-dist/doc/latex/babel/babel.pdf | Bin 854250 -> 858700 bytes Master/texmf-dist/source/latex/babel/babel.dtx | 253 ++++++++++++++------- Master/texmf-dist/source/latex/babel/babel.ins | 2 +- Master/texmf-dist/source/latex/babel/bbcompat.dtx | 2 +- Master/texmf-dist/source/latex/babel/locale.zip | Bin 793811 -> 794467 bytes .../tex/generic/babel/babel-transforms.lua | 10 +- Master/texmf-dist/tex/generic/babel/babel.def | 48 +++- Master/texmf-dist/tex/generic/babel/babel.sty | 48 +++- Master/texmf-dist/tex/generic/babel/hyphen.cfg | 6 +- .../generic/babel/locale/la/babel-la-x-classic.ini | 22 +- .../babel/locale/la/babel-la-x-ecclesia.ini | 22 +- .../babel/locale/la/babel-la-x-medieval.ini | 22 +- .../tex/generic/babel/locale/la/babel-la.ini | 23 +- Master/texmf-dist/tex/generic/babel/luababel.def | 111 +++++---- Master/texmf-dist/tex/generic/babel/nil.ldf | 2 +- 16 files changed, 405 insertions(+), 177 deletions(-) (limited to 'Master') diff --git a/Master/texmf-dist/doc/latex/babel/README.md b/Master/texmf-dist/doc/latex/babel/README.md index 078385c04ea..bfb72cd7cf1 100644 --- a/Master/texmf-dist/doc/latex/babel/README.md +++ b/Master/texmf-dist/doc/latex/babel/README.md @@ -1,4 +1,4 @@ -## Babel 3.66 +## Babel 3.67 This package manages culturally-determined typographical (and other) rules, and hyphenation patterns for a wide range of languages. Many @@ -8,9 +8,9 @@ is a set of ini files for about 250 languages. The latest stable version is available on . -Changes in version 3.66 are described in: +Changes in version 3.67 are described in: -https://latex3.github.io/babel/news/whats-new-in-babel-3.66.html +https://latex3.github.io/babel/news/whats-new-in-babel-3.67.html Apart from the manual, you can find information on some aspects of babel at: @@ -46,6 +46,11 @@ respective authors. ### Summary of Latest changes ``` +3.67 2021-11-29 + * \IfBabelSelectorTF executes code conditionally based on the + selector type (select, foreign, etc.). + * Transforms can be turned on and off based on Lua attributes. + 3.66 2021-11-08 * Transforms for Greek: - transliteration.omega diff --git a/Master/texmf-dist/doc/latex/babel/babel.pdf b/Master/texmf-dist/doc/latex/babel/babel.pdf index 9d0a7963cfe..bf2f6910cae 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 a8d8834ab3d..666c1b1eef8 100644 --- a/Master/texmf-dist/source/latex/babel/babel.dtx +++ b/Master/texmf-dist/source/latex/babel/babel.dtx @@ -32,7 +32,7 @@ % % \iffalse %<*filedriver> -\ProvidesFile{babel.dtx}[2021/11/08 v3.66 The Babel package] +\ProvidesFile{babel.dtx}[2021/11/29 v3.67 The Babel package] \documentclass{ltxdoc} \GetFileInfo{babel.dtx} \usepackage{fontspec} @@ -687,6 +687,12 @@ This command can be used as environment, too. any language, it will get expanded as expected. \end{note} +\begin{note} + Bear in mind |\selectlanguage| can be automatically executed, in some + cases, in the auxiliary files, at heads and foots, and after the + environment |otherlanguage*|. +\end{note} + \begin{warning} If used inside braces there might be some non-local changes, as this would be roughly equivalent to: @@ -3101,6 +3107,16 @@ illustrates: \usepackage[magyar]{babel} \babelprovide[_transforms = digraphs.hyphen_]{magyar} \end{verbatim} +\New{3.67} Transforms predefined in the |ini| locale files can be made +attribute-dependent, too. When an attribute between parenthesis is +inserted subsequent transforms will be assigned to it (up to the list +end or another attribute). For example, +and provided an attribute called |\withsigmafinal| has been declared: +\begin{verbatim} +transforms = transliteration.omega (\withsigmafinal) sigma.final +\end{verbatim} +This applies |transliteration.omega| always, but |sigma.final| only when +|\withsigmafinal| is set. Here are the transforms currently predefined. (More to follow in future releases.) @@ -3164,19 +3180,29 @@ four characters: \textit{!?:;}\,.} danda or double danda if there is a space. For Assamese, Bengali, Gujarati, Hindi, Kannada, Malayalam, Marathi, Oriya, Tamil, Telugu.} -\trans{Arabic, Persian}{kashida.plain}{Experimental. A very simple and -basic transform for ‘plain’ Arabic fonts, which attempts to distribute -the tatwil as evenly as possible (starting at the end of the line). See -the news for version 3.59.} +\trans{Latin}{digraphs.ligatures}{Replaces the groups \textit{ae}, +\textit{AE}, \textit{oe}, \textit{OE} with \textit{æ}, \textit{Æ}, +\textit{œ}, \textit{Œ}.} + +\trans{Latin}{letters.noj}{Replaces \textit{j}, \textit{J} with +\textit{i}, \textit{I}.} + +\trans{Latin}{letters.uv}{Replaces \textit{v}, \textit{U} with +\textit{u}, \textit{V}.} \trans{Serbian}{transliteration.gajica}{(Note |serbian| with |ini| files refers to the Cyrillic script, which is here the target.) The standard system devised by Ljudevit Gaj.} +\trans{Arabic, Persian}{kashida.plain}{Experimental. A very simple and +basic transform for ‘plain’ Arabic fonts, which attempts to distribute +the tatwil as evenly as possible (starting at the end of the line). See +the news for version 3.59.} + \vspace{2mm}\hrule\nobreak \endgroup -\Describe{\babelposthyphenation}{\marg{hyphenrules-name}% +\Describe{\babelposthyphenation}{\oarg{options}\marg{hyphenrules-name}% \marg{lua-pattern}\marg{replacement}} \New{3.37-3.39} \textit{With \luatex{}} it is possible to define @@ -3202,6 +3228,18 @@ to \textit{ύ}, so that the diaeresis is removed. This feature is activated with the first |\babelposthyphenation| or |\babelprehyphenation|. +\New{3.67} With the optional argument you can associate a user defined +transform to an attribute, so that it’s active only when it’s set +(currently its attribute value is ignored). With this mechanism +transforms can be set or unset even in the middle of paragraphs, and +applied to single words. To define, set and unset the attribute, the +LaTeX kernel provides the macros |\newattribute|, |\setattribute| and +|\unsetattribute|. The following example shows how to use it, provided +an attribute named |\latinnoj| has been declared: +\begin{verbatim} + \babelprehyphenation[attribute=\latinnoj]{latin}{ J }{ string = I } +\end{verbatim} + See the \href{https://latex3.github.io/babel/guides/% non-standard-hyphenation-with-luatex.html}{\babel\ site} for a more @@ -3215,7 +3253,7 @@ applied, so you must take discretionaries into account). You are limited to substitutions as done by \textsf{lua}, although a future implementation may alternatively accept \textsf{lpeg}. -\Describe{\babelprehyphenation}{\marg{locale-name}% +\Describe{\babelprehyphenation}{\oarg{options}\marg{locale-name}% \marg{lua-pattern}\marg{replacement}} \New{3.44-3-52} It is similar to the latter, but (as its name implies) @@ -3226,6 +3264,8 @@ search patterns |=| has no special meaning, while \verb+|+ stands for an ordinary space; (3) in the replacement, discretionaries are not accepted. +See the description above for the optional argument. + This feature is activated with the first |\babelposthyphenation| or |\babelprehyphenation|. @@ -4867,6 +4907,21 @@ This macro is not intended to fix wrong mappings done by Unicode (which are the default in both \xetex{} and \luatex{}) -- if an assignment is wrong, fix it directly. +\subsection{Executing code based on the selector} + +\Describe{\IfBabelSelectorTF}{\marg{selectors}\marg{true}\marg{false}} + +\New{3.67} Sometimes a different setup is desired depending on the +selector used. Values allowed in \m{selectors} are |select|, |other|, +|foreign|, |other*| (and also |foreign*| for the tentative starred +version), and it can consist of a comma-separated list. For example: +\begin{verbatim} +\IfBabelSelectorTF{other, other*}{A}{B} +\end{verbatim} +is true with these two environment selectors. + +Its natural place of use is in hooks or in |\extras|\m{language}. + \section{Changes} \subsection{Changes in \babel\ version 3.9} @@ -5063,8 +5118,8 @@ help from Bernd Raichle, for which I am grateful. % \section{Tools} % % \begin{macrocode} -%<> -%<> +%<> +%<> % \end{macrocode} % % \textbf{Do not use the following macros in \texttt{ldf} files. They @@ -6312,7 +6367,10 @@ help from Bernd Raichle, for which I am grateful. \newif\ifbbl@bcpallowed \bbl@bcpallowedfalse \def\select@language#1{% from set@, babel@aux + \ifx\bbl@selectorname\@empty + \def\bbl@selectorname{select}% % set hymap + \fi \ifnum\bbl@hymapsel=\@cclv\chardef\bbl@hymapsel4\relax\fi % set name \edef\languagename{#1}% @@ -6453,7 +6511,8 @@ help from Bernd Raichle, for which I am grateful. \else \expandafter\expandafter\expandafter\set@hyphenmins \csname #1hyphenmins\endcsname\relax - \fi} + \fi + \let\bbl@selectorname\@empty} % \end{macrocode} % % \begin{environment}{otherlanguage} @@ -6468,6 +6527,7 @@ help from Bernd Raichle, for which I am grateful. % % \begin{macrocode} \long\def\otherlanguage#1{% + \def\bbl@selectorname{other}% \ifnum\bbl@hymapsel=\@cclv\let\bbl@hymapsel\thr@@\fi \csname selectlanguage \endcsname{#1}% \ignorespaces} @@ -6493,6 +6553,7 @@ help from Bernd Raichle, for which I am grateful. \expandafter\def\csname otherlanguage*\endcsname{% \@ifnextchar[\bbl@otherlanguage@s{\bbl@otherlanguage@s[]}} \def\bbl@otherlanguage@s[#1]#2{% + \def\bbl@selectorname{other*}% \ifnum\bbl@hymapsel=\@cclv\chardef\bbl@hymapsel4\relax\fi \def\bbl@select@opts{#1}% \foreign@language{#2}} @@ -6556,6 +6617,7 @@ help from Bernd Raichle, for which I am grateful. \@ifstar\bbl@foreign@s\bbl@foreign@x} \providecommand\bbl@foreign@x[3][]{% \begingroup + \def\bbl@selectorname{foreign}% \def\bbl@select@opts{#1}% \let\BabelText\@firstofone \bbl@beforeforeign @@ -6566,6 +6628,7 @@ help from Bernd Raichle, for which I am grateful. \def\bbl@foreign@s#1#2{% TODO - \shapemode, \@setpar, ?\@@par \begingroup {\par}% + \def\bbl@selectorname{foreign*}% \let\bbl@select@opts\@empty \let\BabelText\@firstofone \foreign@language{#1}% @@ -6612,7 +6675,20 @@ help from Bernd Raichle, for which I am grateful. \expandafter\bbl@switch\expandafter{\languagename}}} % \end{macrocode} % -% \end{macro} +% \end{macro} +% +% The following macro executes conditionally some code based on the +% selector being used. +% +% \begin{macrocode} +\def\IfBabelSelectorTF#1{% + \bbl@xin@{,\bbl@selectorname,}{,\zap@space#1 \@empty,}% + \ifin@ + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi} +% \end{macrocode} % % \begin{macro}{\bbl@patterns} % @@ -6781,7 +6857,6 @@ help from Bernd Raichle, for which I am grateful. \let\uselocale\setlocale \let\locale\setlocale \let\selectlocale\setlocale -\let\localename\setlocale \let\textlocale\setlocale \let\textlanguage\setlocale \let\languagetext\setlocale @@ -10680,14 +10755,15 @@ help from Bernd Raichle, for which I am grateful. \bbl@transforms\babelprehyphenation} \@namedef{bbl@inikv@transforms.posthyphenation}{% \bbl@transforms\babelposthyphenation} -\def\bbl@transforms@aux#1#2#3,#4\relax{#1{#2}{#3}{#4}} +\def\bbl@transforms@aux#1#2#3#4,#5\relax{% + #1[#2]{#3}{#4}{#5}} \begingroup % A hack. TODO. Don't require an specific order \catcode`\%=12 \catcode`\&=14 \gdef\bbl@transforms#1#2#3{&% \ifx\bbl@KVP@transforms\@nil\else \directlua{ - str = [==[#2]==] + local str = [==[#2]==] str = str:gsub('%.%d+%.%d+$', '') tex.print([[\def\string\babeltempa{]] .. str .. [[}]]) }&% @@ -10695,10 +10771,23 @@ help from Bernd Raichle, for which I am grateful. \ifin@ \in@{.0$}{#2$}&% \ifin@ - \g@addto@macro\bbl@release@transforms{&% - \relax\bbl@transforms@aux#1{\languagename}{#3}}&% + \directlua{ + local str = string.match([[\bbl@KVP@transforms]], + '%(([^%(]-)%)[^%)]-\babeltempa') + if str == nil then + tex.print([[\def\string\babeltempb{}]]) + else + tex.print([[\def\string\babeltempb{,attribute=]] .. str .. [[}]]) + end + } + \toks@{#3}&% + \bbl@exp{&% + \\\g@addto@macro\\\bbl@release@transforms{&% + \relax &% Closes previous \bbl@transforms@aux + \\\bbl@transforms@aux + \\#1{label=\babeltempa\babeltempb}{\languagename}{\the\toks@}}}&% \else - \g@addto@macro\bbl@release@transforms{, {#3}}&% + \g@addto@macro\bbl@release@transforms{, {#3}}&% \fi \fi \fi} @@ -14212,13 +14301,21 @@ end \catcode`\~=12 \catcode`\%=12 \catcode`\&=14 -\gdef\babelposthyphenation#1#2#3{&% - \bbl@activateposthyphen +\gdef\babelprehyphenation{&% + \@ifnextchar[{\bbl@settransform{0}}{\bbl@settransform{0}[]}} +\gdef\babelposthyphenation{&% + \@ifnextchar[{\bbl@settransform{1}}{\bbl@settransform{1}[]}} +\gdef\bbl@settransform#1[#2]#3#4#5{&% + \ifcase#1 + \bbl@activateprehyphen + \else + \bbl@activateposthyphen + \fi \begingroup \def\babeltempa{\bbl@add@list\babeltempb}&% \let\babeltempb\@empty - \def\bbl@tempa{#3}&% TODO. Ugly trick to preserve {}: - \bbl@replace\bbl@tempa{,}{ ,}&% + \def\bbl@tempa{#5}&% + \bbl@replace\bbl@tempa{,}{ ,}&% TODO. Ugly trick to preserve {} \expandafter\bbl@foreach\expandafter{\bbl@tempa}{&% \bbl@ifsamestring{##1}{remove}&% {\bbl@add@list\babeltempb{nil}}&% @@ -14226,82 +14323,68 @@ end local rep = [=[##1]=] rep = rep:gsub('^%s*(remove)%s*$', 'remove = true') rep = rep:gsub('^%s*(insert)%s*,', 'insert = true, ') - rep = rep:gsub( '(no)%s*=%s*([^%s,]*)', Babel.capture_func) - rep = rep:gsub( '(pre)%s*=%s*([^%s,]*)', Babel.capture_func) - rep = rep:gsub( '(post)%s*=%s*([^%s,]*)', Babel.capture_func) - rep = rep:gsub('(string)%s*=%s*([^%s,]*)', Babel.capture_func) + rep = rep:gsub('(string)%s*=%s*([^%s,]*)', Babel.capture_func) + if #1 == 0 then + rep = rep:gsub('(space)%s*=%s*([%d%.]+)%s+([%d%.]+)%s+([%d%.]+)', + 'space = {' .. '%2, %3, %4' .. '}') + rep = rep:gsub('(spacefactor)%s*=%s*([%d%.]+)%s+([%d%.]+)%s+([%d%.]+)', + 'spacefactor = {' .. '%2, %3, %4' .. '}') + rep = rep:gsub('(kashida)%s*=%s*([^%s,]*)', Babel.capture_kashida) + else + rep = rep:gsub( '(no)%s*=%s*([^%s,]*)', Babel.capture_func) + rep = rep:gsub( '(pre)%s*=%s*([^%s,]*)', Babel.capture_func) + rep = rep:gsub( '(post)%s*=%s*([^%s,]*)', Babel.capture_func) + end tex.print([[\string\babeltempa{{]] .. rep .. [[}}]]) }}}&% + \let\bbl@kv@attribute\relax + \let\bbl@kv@label\relax + \bbl@forkv{#2}{\bbl@csarg\edef{kv@##1}{##2}}&% + \ifx\bbl@kv@attribute\relax\else + \edef\bbl@kv@attribute{\expandafter\bbl@stripslash\bbl@kv@attribute}&% + \fi \directlua{ - local lbkr = Babel.linebreaking.replacements[1] + local lbkr = Babel.linebreaking.replacements[#1] local u = unicode.utf8 - local id = \the\csname l@#1\endcsname + local id, attr, label + if #1 == 0 then + id = \the\csname bbl@id@@#3\endcsname\space + else + id = \the\csname l@#3\endcsname\space + end + \ifx\bbl@kv@attribute\relax + attr = -1 + \else + attr = luatexbase.registernumber'\bbl@kv@attribute' + \fi + \ifx\bbl@kv@label\relax\else &% Same refs: + label = [==[\bbl@kv@label]==] + \fi &% Convert pattern: - local patt = string.gsub([==[#2]==], '%s', '') + local patt = string.gsub([==[#4]==], '%s', '') + if #1 == 0 then + patt = string.gsub(patt, '|', ' ') + end if not u.find(patt, '()', nil, true) then patt = '()' .. patt .. '()' end - patt = string.gsub(patt, '%(%)%^', '^()') - patt = string.gsub(patt, '%$%(%)', '()$') - patt = u.gsub(patt, '{(.)}', + if #1 == 1 then + patt = string.gsub(patt, '%(%)%^', '^()') + patt = string.gsub(patt, '%$%(%)', '()$') + end + patt = u.gsub(patt, '{(.)}', function (n) return '%' .. (tonumber(n) and (tonumber(n)+1) or n) end) patt = u.gsub(patt, '{(%x%x%x%x+)}', function (n) return u.gsub(u.char(tonumber(n, 16)), '(%p)', '%%%1') - end) + end) lbkr[id] = lbkr[id] or {} - table.insert(lbkr[id], { pattern = patt, replace = { \babeltempb } }) + table.insert(lbkr[id], + { label=label, attr=attr, pattern=patt, replace={\babeltempb} }) }&% \endgroup} -% TODO. Copypaste pattern. -\gdef\babelprehyphenation#1#2#3{&% - \bbl@activateprehyphen - \begingroup - \def\babeltempa{\bbl@add@list\babeltempb}&% - \let\babeltempb\@empty - \def\bbl@tempa{#3}&% TODO. Ugly trick to preserve {}: - \bbl@replace\bbl@tempa{,}{ ,}&% - \expandafter\bbl@foreach\expandafter{\bbl@tempa}{&% - \bbl@ifsamestring{##1}{remove}&% - {\bbl@add@list\babeltempb{nil}}&% - {\directlua{ - local rep = [=[##1]=] - rep = rep:gsub('^%s*(remove)%s*$', 'remove = true') - rep = rep:gsub('^%s*(insert)%s*,', 'insert = true, ') - rep = rep:gsub('(string)%s*=%s*([^%s,]*)', Babel.capture_func) - rep = rep:gsub('(space)%s*=%s*([%d%.]+)%s+([%d%.]+)%s+([%d%.]+)', - 'space = {' .. '%2, %3, %4' .. '}') - rep = rep:gsub('(spacefactor)%s*=%s*([%d%.]+)%s+([%d%.]+)%s+([%d%.]+)', - 'spacefactor = {' .. '%2, %3, %4' .. '}') - rep = rep:gsub('(kashida)%s*=%s*([^%s,]*)', Babel.capture_kashida) - tex.print([[\string\babeltempa{{]] .. rep .. [[}}]]) - }}}&% - \directlua{ - local lbkr = Babel.linebreaking.replacements[0] - local u = unicode.utf8 - local id = \the\csname bbl@id@@#1\endcsname - &% Convert pattern: - local patt = string.gsub([==[#2]==], '%s', '') - local patt = string.gsub(patt, '|', ' ') - if not u.find(patt, '()', nil, true) then - patt = '()' .. patt .. '()' - end - &% patt = string.gsub(patt, '%(%)%^', '^()') - &% patt = string.gsub(patt, '([^%%])%$%(%)', '%1()$') - patt = u.gsub(patt, '{(.)}', - function (n) - return '%' .. (tonumber(n) and (tonumber(n)+1) or n) - end) - patt = u.gsub(patt, '{(%x%x%x%x+)}', - function (n) - return u.gsub(u.char(tonumber(n, 16)), '(%p)', '%%%1') - end) - lbkr[id] = lbkr[id] or {} - table.insert(lbkr[id], { pattern = patt, replace = { \babeltempb } }) - }&% - \endgroup} \endgroup \def\bbl@activateposthyphen{% \let\bbl@activateposthyphen\relax @@ -14867,6 +14950,7 @@ function Babel.hyphenate_replace(head, mode) for k=1, #lbkr[lang] do local p = lbkr[lang][k].pattern local r = lbkr[lang][k].replace + local attr = lbkr[lang][k].attr or -1 if Babel.debug then print('*****', p, mode) @@ -14911,8 +14995,15 @@ function Babel.hyphenate_replace(head, mode) local sc = first-1 -- Used below, too local data_nodes = {} + local enabled = true for q = 1, last-first+1 do data_nodes[q] = w_nodes[sc+q] + if enabled + and attr > -1 + and not node.has_attribute(data_nodes[q], attr) + then + enabled = false + end end -- This loop traverses the matched substring and takes the @@ -14956,7 +15047,7 @@ function Babel.hyphenate_replace(head, mode) step = crep.step or 0 end - if crep and next(crep) == nil then -- = {} + if (not enabled) or (crep and next(crep) == nil) then -- = {} last_match = save_last -- Optimization goto next diff --git a/Master/texmf-dist/source/latex/babel/babel.ins b/Master/texmf-dist/source/latex/babel/babel.ins index 387ab64241d..1be32b20baf 100644 --- a/Master/texmf-dist/source/latex/babel/babel.ins +++ b/Master/texmf-dist/source/latex/babel/babel.ins @@ -26,7 +26,7 @@ %% and covered by LPPL is defined by the unpacking scripts (with %% extension .ins) which are part of the distribution. %% -\def\filedate{2021/11/08} +\def\filedate{2021/11/29} \def\batchfile{babel.ins} \input docstrip.tex diff --git a/Master/texmf-dist/source/latex/babel/bbcompat.dtx b/Master/texmf-dist/source/latex/babel/bbcompat.dtx index 5936dfafa14..0b0d1c2af72 100644 --- a/Master/texmf-dist/source/latex/babel/bbcompat.dtx +++ b/Master/texmf-dist/source/latex/babel/bbcompat.dtx @@ -30,7 +30,7 @@ % % \iffalse %<*dtx> -\ProvidesFile{bbcompat.dtx}[2021/11/08 v3.66] +\ProvidesFile{bbcompat.dtx}[2021/11/29 v3.67] % % %% File 'bbcompat.dtx' diff --git a/Master/texmf-dist/source/latex/babel/locale.zip b/Master/texmf-dist/source/latex/babel/locale.zip index 385300f734b..e4b081de5c1 100644 Binary files a/Master/texmf-dist/source/latex/babel/locale.zip and b/Master/texmf-dist/source/latex/babel/locale.zip differ diff --git a/Master/texmf-dist/tex/generic/babel/babel-transforms.lua b/Master/texmf-dist/tex/generic/babel/babel-transforms.lua index a221903b153..fee8a1515b8 100644 --- a/Master/texmf-dist/tex/generic/babel/babel-transforms.lua +++ b/Master/texmf-dist/tex/generic/babel/babel-transforms.lua @@ -209,6 +209,7 @@ function Babel.hyphenate_replace(head, mode) for k=1, #lbkr[lang] do local p = lbkr[lang][k].pattern local r = lbkr[lang][k].replace + local attr = lbkr[lang][k].attr or -1 if Babel.debug then print('*****', p, mode) @@ -253,8 +254,15 @@ function Babel.hyphenate_replace(head, mode) local sc = first-1 -- Used below, too local data_nodes = {} + local enabled = true for q = 1, last-first+1 do data_nodes[q] = w_nodes[sc+q] + if enabled + and attr > -1 + and not node.has_attribute(data_nodes[q], attr) + then + enabled = false + end end -- This loop traverses the matched substring and takes the @@ -298,7 +306,7 @@ function Babel.hyphenate_replace(head, mode) step = crep.step or 0 end - if crep and next(crep) == nil then -- = {} + if (not enabled) or (crep and next(crep) == nil) then -- = {} last_match = save_last -- Optimization goto next diff --git a/Master/texmf-dist/tex/generic/babel/babel.def b/Master/texmf-dist/tex/generic/babel/babel.def index 9d9dce86a61..d80ec90556c 100644 --- a/Master/texmf-dist/tex/generic/babel/babel.def +++ b/Master/texmf-dist/tex/generic/babel/babel.def @@ -40,7 +40,7 @@ \wlog{File: #1 #4 #3 <#2>}% \let\ProvidesFile\@undefined} \fi -\ProvidesFile{babel.def}[2021/11/08 3.66 Babel common definitions] +\ProvidesFile{babel.def}[2021/11/29 3.67 Babel common definitions] \ifx\AtBeginDocument\@undefined % TODO. change test. \def\@empty{} \def\loadlocalcfg#1{% @@ -406,8 +406,8 @@ \expandafter\newif\csname ifbbl@single\endcsname \chardef\bbl@bidimode\z@ \fi -\def\bbl@version{3.66} -\def\bbl@date{2021/11/08} +\def\bbl@version{3.67} +\def\bbl@date{2021/11/29} \ifx\language\@undefined \csname newcount\endcsname\language \fi @@ -620,7 +620,10 @@ \newif\ifbbl@bcpallowed \bbl@bcpallowedfalse \def\select@language#1{% from set@, babel@aux + \ifx\bbl@selectorname\@empty + \def\bbl@selectorname{select}% % set hymap + \fi \ifnum\bbl@hymapsel=\@cclv\chardef\bbl@hymapsel4\relax\fi % set name \edef\languagename{#1}% @@ -730,8 +733,10 @@ \else \expandafter\expandafter\expandafter\set@hyphenmins \csname #1hyphenmins\endcsname\relax - \fi} + \fi + \let\bbl@selectorname\@empty} \long\def\otherlanguage#1{% + \def\bbl@selectorname{other}% \ifnum\bbl@hymapsel=\@cclv\let\bbl@hymapsel\thr@@\fi \csname selectlanguage \endcsname{#1}% \ignorespaces} @@ -740,6 +745,7 @@ \expandafter\def\csname otherlanguage*\endcsname{% \@ifnextchar[\bbl@otherlanguage@s{\bbl@otherlanguage@s[]}} \def\bbl@otherlanguage@s[#1]#2{% + \def\bbl@selectorname{other*}% \ifnum\bbl@hymapsel=\@cclv\chardef\bbl@hymapsel4\relax\fi \def\bbl@select@opts{#1}% \foreign@language{#2}} @@ -752,6 +758,7 @@ \@ifstar\bbl@foreign@s\bbl@foreign@x} \providecommand\bbl@foreign@x[3][]{% \begingroup + \def\bbl@selectorname{foreign}% \def\bbl@select@opts{#1}% \let\BabelText\@firstofone \bbl@beforeforeign @@ -762,6 +769,7 @@ \def\bbl@foreign@s#1#2{% TODO - \shapemode, \@setpar, ?\@@par \begingroup {\par}% + \def\bbl@selectorname{foreign*}% \let\bbl@select@opts\@empty \let\BabelText\@firstofone \foreign@language{#1}% @@ -794,6 +802,13 @@ % set type \let\bbl@select@type\@ne \expandafter\bbl@switch\expandafter{\languagename}}} +\def\IfBabelSelectorTF#1{% + \bbl@xin@{,\bbl@selectorname,}{,\zap@space#1 \@empty,}% + \ifin@ + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi} \let\bbl@hyphlist\@empty \let\bbl@hyphenation@\relax \let\bbl@pttnlist\@empty @@ -869,7 +884,6 @@ \let\uselocale\setlocale \let\locale\setlocale \let\selectlocale\setlocale -\let\localename\setlocale \let\textlocale\setlocale \let\textlanguage\setlocale \let\languagetext\setlocale @@ -3345,14 +3359,15 @@ \bbl@transforms\babelprehyphenation} \@namedef{bbl@inikv@transforms.posthyphenation}{% \bbl@transforms\babelposthyphenation} -\def\bbl@transforms@aux#1#2#3,#4\relax{#1{#2}{#3}{#4}} +\def\bbl@transforms@aux#1#2#3#4,#5\relax{% + #1[#2]{#3}{#4}{#5}} \begingroup % A hack. TODO. Don't require an specific order \catcode`\%=12 \catcode`\&=14 \gdef\bbl@transforms#1#2#3{&% \ifx\bbl@KVP@transforms\@nil\else \directlua{ - str = [==[#2]==] + local str = [==[#2]==] str = str:gsub('%.%d+%.%d+$', '') tex.print([[\def\string\babeltempa{]] .. str .. [[}]]) }&% @@ -3360,10 +3375,23 @@ \ifin@ \in@{.0$}{#2$}&% \ifin@ - \g@addto@macro\bbl@release@transforms{&% - \relax\bbl@transforms@aux#1{\languagename}{#3}}&% + \directlua{ + local str = string.match([[\bbl@KVP@transforms]], + '%(([^%(]-)%)[^%)]-\babeltempa') + if str == nil then + tex.print([[\def\string\babeltempb{}]]) + else + tex.print([[\def\string\babeltempb{,attribute=]] .. str .. [[}]]) + end + } + \toks@{#3}&% + \bbl@exp{&% + \\\g@addto@macro\\\bbl@release@transforms{&% + \relax &% Closes previous \bbl@transforms@aux + \\\bbl@transforms@aux + \\#1{label=\babeltempa\babeltempb}{\languagename}{\the\toks@}}}&% \else - \g@addto@macro\bbl@release@transforms{, {#3}}&% + \g@addto@macro\bbl@release@transforms{, {#3}}&% \fi \fi \fi} diff --git a/Master/texmf-dist/tex/generic/babel/babel.sty b/Master/texmf-dist/tex/generic/babel/babel.sty index b214975d903..991dbb42e3f 100644 --- a/Master/texmf-dist/tex/generic/babel/babel.sty +++ b/Master/texmf-dist/tex/generic/babel/babel.sty @@ -34,7 +34,7 @@ %% \NeedsTeXFormat{LaTeX2e}[2005/12/01] -\ProvidesPackage{babel}[2021/11/08 3.66 The Babel package] +\ProvidesPackage{babel}[2021/11/29 3.67 The Babel package] \@ifpackagewith{babel}{debug} {\providecommand\bbl@trace[1]{\message{^^J[ #1 ]}}% \let\bbl@debug\@firstofone @@ -458,8 +458,8 @@ \expandafter\@secondoftwo \fi} \fi -\def\bbl@version{3.66} -\def\bbl@date{2021/11/08} +\def\bbl@version{3.67} +\def\bbl@date{2021/11/29} \ifx\language\@undefined \csname newcount\endcsname\language \fi @@ -672,7 +672,10 @@ \newif\ifbbl@bcpallowed \bbl@bcpallowedfalse \def\select@language#1{% from set@, babel@aux + \ifx\bbl@selectorname\@empty + \def\bbl@selectorname{select}% % set hymap + \fi \ifnum\bbl@hymapsel=\@cclv\chardef\bbl@hymapsel4\relax\fi % set name \edef\languagename{#1}% @@ -782,8 +785,10 @@ \else \expandafter\expandafter\expandafter\set@hyphenmins \csname #1hyphenmins\endcsname\relax - \fi} + \fi + \let\bbl@selectorname\@empty} \long\def\otherlanguage#1{% + \def\bbl@selectorname{other}% \ifnum\bbl@hymapsel=\@cclv\let\bbl@hymapsel\thr@@\fi \csname selectlanguage \endcsname{#1}% \ignorespaces} @@ -792,6 +797,7 @@ \expandafter\def\csname otherlanguage*\endcsname{% \@ifnextchar[\bbl@otherlanguage@s{\bbl@otherlanguage@s[]}} \def\bbl@otherlanguage@s[#1]#2{% + \def\bbl@selectorname{other*}% \ifnum\bbl@hymapsel=\@cclv\chardef\bbl@hymapsel4\relax\fi \def\bbl@select@opts{#1}% \foreign@language{#2}} @@ -804,6 +810,7 @@ \@ifstar\bbl@foreign@s\bbl@foreign@x} \providecommand\bbl@foreign@x[3][]{% \begingroup + \def\bbl@selectorname{foreign}% \def\bbl@select@opts{#1}% \let\BabelText\@firstofone \bbl@beforeforeign @@ -814,6 +821,7 @@ \def\bbl@foreign@s#1#2{% TODO - \shapemode, \@setpar, ?\@@par \begingroup {\par}% + \def\bbl@selectorname{foreign*}% \let\bbl@select@opts\@empty \let\BabelText\@firstofone \foreign@language{#1}% @@ -846,6 +854,13 @@ % set type \let\bbl@select@type\@ne \expandafter\bbl@switch\expandafter{\languagename}}} +\def\IfBabelSelectorTF#1{% + \bbl@xin@{,\bbl@selectorname,}{,\zap@space#1 \@empty,}% + \ifin@ + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi} \let\bbl@hyphlist\@empty \let\bbl@hyphenation@\relax \let\bbl@pttnlist\@empty @@ -921,7 +936,6 @@ \let\uselocale\setlocale \let\locale\setlocale \let\selectlocale\setlocale -\let\localename\setlocale \let\textlocale\setlocale \let\textlanguage\setlocale \let\languagetext\setlocale @@ -3397,14 +3411,15 @@ \bbl@transforms\babelprehyphenation} \@namedef{bbl@inikv@transforms.posthyphenation}{% \bbl@transforms\babelposthyphenation} -\def\bbl@transforms@aux#1#2#3,#4\relax{#1{#2}{#3}{#4}} +\def\bbl@transforms@aux#1#2#3#4,#5\relax{% + #1[#2]{#3}{#4}{#5}} \begingroup % A hack. TODO. Don't require an specific order \catcode`\%=12 \catcode`\&=14 \gdef\bbl@transforms#1#2#3{&% \ifx\bbl@KVP@transforms\@nil\else \directlua{ - str = [==[#2]==] + local str = [==[#2]==] str = str:gsub('%.%d+%.%d+$', '') tex.print([[\def\string\babeltempa{]] .. str .. [[}]]) }&% @@ -3412,10 +3427,23 @@ \ifin@ \in@{.0$}{#2$}&% \ifin@ - \g@addto@macro\bbl@release@transforms{&% - \relax\bbl@transforms@aux#1{\languagename}{#3}}&% + \directlua{ + local str = string.match([[\bbl@KVP@transforms]], + '%(([^%(]-)%)[^%)]-\babeltempa') + if str == nil then + tex.print([[\def\string\babeltempb{}]]) + else + tex.print([[\def\string\babeltempb{,attribute=]] .. str .. [[}]]) + end + } + \toks@{#3}&% + \bbl@exp{&% + \\\g@addto@macro\\\bbl@release@transforms{&% + \relax &% Closes previous \bbl@transforms@aux + \\\bbl@transforms@aux + \\#1{label=\babeltempa\babeltempb}{\languagename}{\the\toks@}}}&% \else - \g@addto@macro\bbl@release@transforms{, {#3}}&% + \g@addto@macro\bbl@release@transforms{, {#3}}&% \fi \fi \fi} diff --git a/Master/texmf-dist/tex/generic/babel/hyphen.cfg b/Master/texmf-dist/tex/generic/babel/hyphen.cfg index 2f600951541..d020af4e954 100644 --- a/Master/texmf-dist/tex/generic/babel/hyphen.cfg +++ b/Master/texmf-dist/tex/generic/babel/hyphen.cfg @@ -38,10 +38,10 @@ \wlog{File: #1 #4 #3 <#2>}% \let\ProvidesFile\@undefined} \fi -\ProvidesFile{hyphen.cfg}[2021/11/08 3.66 Babel hyphens] +\ProvidesFile{hyphen.cfg}[2021/11/29 3.67 Babel hyphens] \xdef\bbl@format{\jobname} -\def\bbl@version{3.66} -\def\bbl@date{2021/11/08} +\def\bbl@version{3.67} +\def\bbl@date{2021/11/29} \ifx\AtBeginDocument\@undefined \def\@empty{} \fi diff --git a/Master/texmf-dist/tex/generic/babel/locale/la/babel-la-x-classic.ini b/Master/texmf-dist/tex/generic/babel/locale/la/babel-la-x-classic.ini index cf576600356..a6cf0879b27 100644 --- a/Master/texmf-dist/tex/generic/babel/locale/la/babel-la-x-classic.ini +++ b/Master/texmf-dist/tex/generic/babel/locale/la/babel-la-x-classic.ini @@ -11,8 +11,8 @@ [identification] charset = utf8 -version = 1.2 -date = 2020-06-30 +version = 1.3 +date = 2021-11-15 name.english = Classic Latin tag.bcp47 = la-x-classic language.tag.bcp47 = la @@ -150,3 +150,21 @@ hyphenationmin = delimiters.quotes = [counters] + +[transforms.prehyphenation] +digraphs.ligatures.1.0 = { A[Ee] } +digraphs.ligatures.1.1 = { string = Æ } +digraphs.ligatures.1.2 = { remove } +digraphs.ligatures.2.0 = { ae } +digraphs.ligatures.2.1 = { string = æ } +digraphs.ligatures.2.2 = { remove } +digraphs.ligatures.3.0 = { O[Ee] } +digraphs.ligatures.3.1 = { string = Œ } +digraphs.ligatures.3.2 = { remove } +digraphs.ligatures.4.0 = { oe } +digraphs.ligatures.4.1 = { string = œ } +digraphs.ligatures.4.2 = { remove } +letters.noj.1.0 = { ([Jj]) } +letters.noj.1.1 = { string = {1|Jj|Ii} } +letters.uv.1.0 = { ([Uv]) } +letters.uv.1.1 = { string = {1|Uv|Vu} } diff --git a/Master/texmf-dist/tex/generic/babel/locale/la/babel-la-x-ecclesia.ini b/Master/texmf-dist/tex/generic/babel/locale/la/babel-la-x-ecclesia.ini index 47b9f3de961..de282f1577a 100644 --- a/Master/texmf-dist/tex/generic/babel/locale/la/babel-la-x-ecclesia.ini +++ b/Master/texmf-dist/tex/generic/babel/locale/la/babel-la-x-ecclesia.ini @@ -11,8 +11,8 @@ [identification] charset = utf8 -version = 1.2 -date = 2020-06-30 +version = 1.3 +date = 2021-11-15 name.english = Ecclesiastic Latin tag.bcp47 = la-x-ecclesia language.tag.bcp47 = la @@ -150,3 +150,21 @@ hyphenationmin = delimiters.quotes = [counters] + +[transforms.prehyphenation] +digraphs.ligatures.1.0 = { A[Ee] } +digraphs.ligatures.1.1 = { string = Æ } +digraphs.ligatures.1.2 = { remove } +digraphs.ligatures.2.0 = { ae } +digraphs.ligatures.2.1 = { string = æ } +digraphs.ligatures.2.2 = { remove } +digraphs.ligatures.3.0 = { O[Ee] } +digraphs.ligatures.3.1 = { string = Œ } +digraphs.ligatures.3.2 = { remove } +digraphs.ligatures.4.0 = { oe } +digraphs.ligatures.4.1 = { string = œ } +digraphs.ligatures.4.2 = { remove } +letters.noj.1.0 = { ([Jj]) } +letters.noj.1.1 = { string = {1|Jj|Ii} } +letters.uv.1.0 = { ([Uv]) } +letters.uv.1.1 = { string = {1|Uv|Vu} } diff --git a/Master/texmf-dist/tex/generic/babel/locale/la/babel-la-x-medieval.ini b/Master/texmf-dist/tex/generic/babel/locale/la/babel-la-x-medieval.ini index 300c6493305..c2a3fe36658 100644 --- a/Master/texmf-dist/tex/generic/babel/locale/la/babel-la-x-medieval.ini +++ b/Master/texmf-dist/tex/generic/babel/locale/la/babel-la-x-medieval.ini @@ -11,8 +11,8 @@ [identification] charset = utf8 -version = 1.2 -date = 2020-06-30 +version = 1.3 +date = 2021-11-15 name.english = Medieval Latin tag.bcp47 = la-x-medieval language.tag.bcp47 = la @@ -149,3 +149,21 @@ hyphenationmin = delimiters.quotes = [counters] + +[transforms.prehyphenation] +digraphs.ligatures.1.0 = { A[Ee] } +digraphs.ligatures.1.1 = { string = Æ } +digraphs.ligatures.1.2 = { remove } +digraphs.ligatures.2.0 = { ae } +digraphs.ligatures.2.1 = { string = æ } +digraphs.ligatures.2.2 = { remove } +digraphs.ligatures.3.0 = { O[Ee] } +digraphs.ligatures.3.1 = { string = Œ } +digraphs.ligatures.3.2 = { remove } +digraphs.ligatures.4.0 = { oe } +digraphs.ligatures.4.1 = { string = œ } +digraphs.ligatures.4.2 = { remove } +letters.noj.1.0 = { ([Jj]) } +letters.noj.1.1 = { string = {1|Jj|Ii} } +letters.uv.1.0 = { ([Uv]) } +letters.uv.1.1 = { string = {1|Uv|Vu} } diff --git a/Master/texmf-dist/tex/generic/babel/locale/la/babel-la.ini b/Master/texmf-dist/tex/generic/babel/locale/la/babel-la.ini index aca5580b6b8..6da80d3c37f 100644 --- a/Master/texmf-dist/tex/generic/babel/locale/la/babel-la.ini +++ b/Master/texmf-dist/tex/generic/babel/locale/la/babel-la.ini @@ -11,8 +11,8 @@ [identification] charset = utf8 -version = 1.3 -date = 2020-06-30 +version = 1.4 +date = 2021-11-15 name.english = Latin name.babel = latin name.polyglossia = latin @@ -150,3 +150,22 @@ hyphenationmin = delimiters.quotes = [counters] + +[transforms.prehyphenation] +digraphs.ligatures.1.0 = { A[Ee] } +digraphs.ligatures.1.1 = { string = Æ } +digraphs.ligatures.1.2 = { remove } +digraphs.ligatures.2.0 = { ae } +digraphs.ligatures.2.1 = { string = æ } +digraphs.ligatures.2.2 = { remove } +digraphs.ligatures.3.0 = { O[Ee] } +digraphs.ligatures.3.1 = { string = Œ } +digraphs.ligatures.3.2 = { remove } +digraphs.ligatures.4.0 = { oe } +digraphs.ligatures.4.1 = { string = œ } +digraphs.ligatures.4.2 = { remove } +letters.noj.1.0 = { ([Jj]) } +letters.noj.1.1 = { string = {1|Jj|Ii} } +letters.uv.1.0 = { ([Uv]) } +letters.uv.1.1 = { string = {1|Uv|Vu} } + diff --git a/Master/texmf-dist/tex/generic/babel/luababel.def b/Master/texmf-dist/tex/generic/babel/luababel.def index b99ff979189..d5c8c17511b 100644 --- a/Master/texmf-dist/tex/generic/babel/luababel.def +++ b/Master/texmf-dist/tex/generic/babel/luababel.def @@ -1138,13 +1138,21 @@ end \catcode`\~=12 \catcode`\%=12 \catcode`\&=14 -\gdef\babelposthyphenation#1#2#3{&% - \bbl@activateposthyphen +\gdef\babelprehyphenation{&% + \@ifnextchar[{\bbl@settransform{0}}{\bbl@settransform{0}[]}} +\gdef\babelposthyphenation{&% + \@ifnextchar[{\bbl@settransform{1}}{\bbl@settransform{1}[]}} +\gdef\bbl@settransform#1[#2]#3#4#5{&% + \ifcase#1 + \bbl@activateprehyphen + \else + \bbl@activateposthyphen + \fi \begingroup \def\babeltempa{\bbl@add@list\babeltempb}&% \let\babeltempb\@empty - \def\bbl@tempa{#3}&% TODO. Ugly trick to preserve {}: - \bbl@replace\bbl@tempa{,}{ ,}&% + \def\bbl@tempa{#5}&% + \bbl@replace\bbl@tempa{,}{ ,}&% TODO. Ugly trick to preserve {} \expandafter\bbl@foreach\expandafter{\bbl@tempa}{&% \bbl@ifsamestring{##1}{remove}&% {\bbl@add@list\babeltempb{nil}}&% @@ -1152,69 +1160,55 @@ end local rep = [=[##1]=] rep = rep:gsub('^%s*(remove)%s*$', 'remove = true') rep = rep:gsub('^%s*(insert)%s*,', 'insert = true, ') - rep = rep:gsub( '(no)%s*=%s*([^%s,]*)', Babel.capture_func) - rep = rep:gsub( '(pre)%s*=%s*([^%s,]*)', Babel.capture_func) - rep = rep:gsub( '(post)%s*=%s*([^%s,]*)', Babel.capture_func) rep = rep:gsub('(string)%s*=%s*([^%s,]*)', Babel.capture_func) + if #1 == 0 then + rep = rep:gsub('(space)%s*=%s*([%d%.]+)%s+([%d%.]+)%s+([%d%.]+)', + 'space = {' .. '%2, %3, %4' .. '}') + rep = rep:gsub('(spacefactor)%s*=%s*([%d%.]+)%s+([%d%.]+)%s+([%d%.]+)', + 'spacefactor = {' .. '%2, %3, %4' .. '}') + rep = rep:gsub('(kashida)%s*=%s*([^%s,]*)', Babel.capture_kashida) + else + rep = rep:gsub( '(no)%s*=%s*([^%s,]*)', Babel.capture_func) + rep = rep:gsub( '(pre)%s*=%s*([^%s,]*)', Babel.capture_func) + rep = rep:gsub( '(post)%s*=%s*([^%s,]*)', Babel.capture_func) + end tex.print([[\string\babeltempa{{]] .. rep .. [[}}]]) }}}&% + \let\bbl@kv@attribute\relax + \let\bbl@kv@label\relax + \bbl@forkv{#2}{\bbl@csarg\edef{kv@##1}{##2}}&% + \ifx\bbl@kv@attribute\relax\else + \edef\bbl@kv@attribute{\expandafter\bbl@stripslash\bbl@kv@attribute}&% + \fi \directlua{ - local lbkr = Babel.linebreaking.replacements[1] + local lbkr = Babel.linebreaking.replacements[#1] local u = unicode.utf8 - local id = \the\csname l@#1\endcsname - &% Convert pattern: - local patt = string.gsub([==[#2]==], '%s', '') - if not u.find(patt, '()', nil, true) then - patt = '()' .. patt .. '()' + local id, attr, label + if #1 == 0 then + id = \the\csname bbl@id@@#3\endcsname\space + else + id = \the\csname l@#3\endcsname\space end - patt = string.gsub(patt, '%(%)%^', '^()') - patt = string.gsub(patt, '%$%(%)', '()$') - patt = u.gsub(patt, '{(.)}', - function (n) - return '%' .. (tonumber(n) and (tonumber(n)+1) or n) - end) - patt = u.gsub(patt, '{(%x%x%x%x+)}', - function (n) - return u.gsub(u.char(tonumber(n, 16)), '(%p)', '%%%1') - end) - lbkr[id] = lbkr[id] or {} - table.insert(lbkr[id], { pattern = patt, replace = { \babeltempb } }) - }&% - \endgroup} -\gdef\babelprehyphenation#1#2#3{&% - \bbl@activateprehyphen - \begingroup - \def\babeltempa{\bbl@add@list\babeltempb}&% - \let\babeltempb\@empty - \def\bbl@tempa{#3}&% TODO. Ugly trick to preserve {}: - \bbl@replace\bbl@tempa{,}{ ,}&% - \expandafter\bbl@foreach\expandafter{\bbl@tempa}{&% - \bbl@ifsamestring{##1}{remove}&% - {\bbl@add@list\babeltempb{nil}}&% - {\directlua{ - local rep = [=[##1]=] - rep = rep:gsub('^%s*(remove)%s*$', 'remove = true') - rep = rep:gsub('^%s*(insert)%s*,', 'insert = true, ') - rep = rep:gsub('(string)%s*=%s*([^%s,]*)', Babel.capture_func) - rep = rep:gsub('(space)%s*=%s*([%d%.]+)%s+([%d%.]+)%s+([%d%.]+)', - 'space = {' .. '%2, %3, %4' .. '}') - rep = rep:gsub('(spacefactor)%s*=%s*([%d%.]+)%s+([%d%.]+)%s+([%d%.]+)', - 'spacefactor = {' .. '%2, %3, %4' .. '}') - rep = rep:gsub('(kashida)%s*=%s*([^%s,]*)', Babel.capture_kashida) - tex.print([[\string\babeltempa{{]] .. rep .. [[}}]]) - }}}&% - \directlua{ - local lbkr = Babel.linebreaking.replacements[0] - local u = unicode.utf8 - local id = \the\csname bbl@id@@#1\endcsname + \ifx\bbl@kv@attribute\relax + attr = -1 + \else + attr = luatexbase.registernumber'\bbl@kv@attribute' + \fi + \ifx\bbl@kv@label\relax\else &% Same refs: + label = [==[\bbl@kv@label]==] + \fi &% Convert pattern: - local patt = string.gsub([==[#2]==], '%s', '') - local patt = string.gsub(patt, '|', ' ') + local patt = string.gsub([==[#4]==], '%s', '') + if #1 == 0 then + patt = string.gsub(patt, '|', ' ') + end if not u.find(patt, '()', nil, true) then patt = '()' .. patt .. '()' end - &% patt = string.gsub(patt, '%(%)%^', '^()') - &% patt = string.gsub(patt, '([^%%])%$%(%)', '%1()$') + if #1 == 1 then + patt = string.gsub(patt, '%(%)%^', '^()') + patt = string.gsub(patt, '%$%(%)', '()$') + end patt = u.gsub(patt, '{(.)}', function (n) return '%' .. (tonumber(n) and (tonumber(n)+1) or n) @@ -1224,7 +1218,8 @@ end return u.gsub(u.char(tonumber(n, 16)), '(%p)', '%%%1') end) lbkr[id] = lbkr[id] or {} - table.insert(lbkr[id], { pattern = patt, replace = { \babeltempb } }) + table.insert(lbkr[id], + { label=label, attr=attr, pattern=patt, replace={\babeltempb} }) }&% \endgroup} \endgroup diff --git a/Master/texmf-dist/tex/generic/babel/nil.ldf b/Master/texmf-dist/tex/generic/babel/nil.ldf index 94e2ec22721..c484114f956 100644 --- a/Master/texmf-dist/tex/generic/babel/nil.ldf +++ b/Master/texmf-dist/tex/generic/babel/nil.ldf @@ -33,7 +33,7 @@ %% extension |.ins|) which are part of the distribution. %% -\ProvidesLanguage{nil}[2021/11/08 3.66 Nil language] +\ProvidesLanguage{nil}[2021/11/29 3.67 Nil language] \LdfInit{nil}{datenil} \ifx\l@nil\@undefined \newlanguage\l@nil -- cgit v1.2.3