diff options
author | Karl Berry <karl@freefriends.org> | 2021-11-29 21:13:12 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-11-29 21:13:12 +0000 |
commit | fffd05cae905f23ad2300395a5ead86d7c0253cd (patch) | |
tree | 0bdd2c0e52d5481ce26d77492a593fce5036fa3e /Master/texmf-dist/tex/generic | |
parent | 82a638461359e5fd966fdca40ae90d9c018d7e99 (diff) |
babel (29nov21)
git-svn-id: svn://tug.org/texlive/trunk@61186 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic')
10 files changed, 223 insertions, 91 deletions
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 |