texlive[61186] Master/texmf-dist: babel (29nov21)

commits+karl at tug.org commits+karl at tug.org
Mon Nov 29 22:13:12 CET 2021


Revision: 61186
          http://tug.org/svn/texlive?view=revision&revision=61186
Author:   karl
Date:     2021-11-29 22:13:12 +0100 (Mon, 29 Nov 2021)
Log Message:
-----------
babel (29nov21)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/babel/README.md
    trunk/Master/texmf-dist/doc/latex/babel/babel.pdf
    trunk/Master/texmf-dist/source/latex/babel/babel.dtx
    trunk/Master/texmf-dist/source/latex/babel/babel.ins
    trunk/Master/texmf-dist/source/latex/babel/bbcompat.dtx
    trunk/Master/texmf-dist/source/latex/babel/locale.zip
    trunk/Master/texmf-dist/tex/generic/babel/babel-transforms.lua
    trunk/Master/texmf-dist/tex/generic/babel/babel.def
    trunk/Master/texmf-dist/tex/generic/babel/babel.sty
    trunk/Master/texmf-dist/tex/generic/babel/hyphen.cfg
    trunk/Master/texmf-dist/tex/generic/babel/locale/la/babel-la-x-classic.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/la/babel-la-x-ecclesia.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/la/babel-la-x-medieval.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/la/babel-la.ini
    trunk/Master/texmf-dist/tex/generic/babel/luababel.def
    trunk/Master/texmf-dist/tex/generic/babel/nil.ldf

Modified: trunk/Master/texmf-dist/doc/latex/babel/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/babel/README.md	2021-11-29 21:11:43 UTC (rev 61185)
+++ trunk/Master/texmf-dist/doc/latex/babel/README.md	2021-11-29 21:13:12 UTC (rev 61186)
@@ -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 @@
 
 The latest stable version is available on <https://ctan.org/pkg/babel>.
 
-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 @@
 
 ### 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

Modified: trunk/Master/texmf-dist/doc/latex/babel/babel.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/babel/babel.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/babel/babel.dtx	2021-11-29 21:11:43 UTC (rev 61185)
+++ trunk/Master/texmf-dist/source/latex/babel/babel.dtx	2021-11-29 21:13:12 UTC (rev 61186)
@@ -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 @@
   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 @@
   \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 @@
 danda or double danda if there is a space. For Assamese, Bengali,
 Gujarati, Hindi, Kannada, Malayalam, Marathi, Oriya, Tamil, Telugu.}
 
+\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.}
 
-\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.}
-
 \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 @@
 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 @@
 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 @@
 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 @@
 (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 @@
 % \section{Tools}
 %
 %    \begin{macrocode}
-%<<version=3.66>>
-%<<date=2021/11/08>>
+%<<version=3.67>>
+%<<date=2021/11/29>>
 %    \end{macrocode}
 %
 % \textbf{Do not use the following macros in \texttt{ldf} files. They
@@ -6312,7 +6367,10 @@
 \newif\ifbbl at bcpallowed
 \bbl at bcpallowedfalse
 \def\select at language#1{% from set@, babel at aux
+  \ifx\bbl at selectorname\@empty
+    \def\bbl at selectorname{select}%
   % set hymap
+  \fi
   \ifnum\bbl at hymapsel=\@cclv\chardef\bbl at hymapsel4\relax\fi
   % set name
   \edef\languagename{#1}%
@@ -6453,7 +6511,8 @@
   \else
     \expandafter\expandafter\expandafter\set at hyphenmins
       \csname #1hyphenmins\endcsname\relax
-  \fi}
+  \fi
+  \let\bbl at selectorname\@empty}
 %    \end{macrocode}
 %
 % \begin{environment}{otherlanguage}
@@ -6468,6 +6527,7 @@
 %
 %    \begin{macrocode}
 \long\def\otherlanguage#1{%
+  \def\bbl at selectorname{other}%
   \ifnum\bbl at hymapsel=\@cclv\let\bbl at hymapsel\thr@@\fi
   \csname selectlanguage \endcsname{#1}%
   \ignorespaces}
@@ -6493,6 +6553,7 @@
 \expandafter\def\csname otherlanguage*\endcsname{%
   \@ifnextchar[\bbl at otherlanguage@s{\bbl at otherlanguage@s[]}}
 \def\bbl at otherlanguage@s[#1]#2{%
+  \def\bbl at selectorname{other*}%
   \ifnum\bbl at hymapsel=\@cclv\chardef\bbl at hymapsel4\relax\fi
   \def\bbl at select@opts{#1}%
   \foreign at language{#2}}
@@ -6556,6 +6617,7 @@
   \@ifstar\bbl at foreign@s\bbl at foreign@x}
 \providecommand\bbl at foreign@x[3][]{%
   \begingroup
+    \def\bbl at selectorname{foreign}%
     \def\bbl at select@opts{#1}%
     \let\BabelText\@firstofone
     \bbl at beforeforeign
@@ -6566,6 +6628,7 @@
 \def\bbl at foreign@s#1#2{% TODO - \shapemode, \@setpar, ?\@@par
   \begingroup
     {\par}%
+    \def\bbl at selectorname{foreign*}%
     \let\bbl at select@opts\@empty
     \let\BabelText\@firstofone
     \foreign at language{#1}%
@@ -6612,8 +6675,21 @@
     \expandafter\bbl at 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 at xin@{,\bbl at selectorname,}{,\zap at space#1 \@empty,}%
+  \ifin@
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi}
+%    \end{macrocode}
+%
 % \begin{macro}{\bbl at patterns}
 %
 % This macro selects the hyphenation patterns by changing the
@@ -6781,7 +6857,6 @@
 \let\uselocale\setlocale
 \let\locale\setlocale
 \let\selectlocale\setlocale
-\let\localename\setlocale
 \let\textlocale\setlocale
 \let\textlanguage\setlocale
 \let\languagetext\setlocale
@@ -10680,7 +10755,8 @@
   \bbl at transforms\babelprehyphenation}
 \@namedef{bbl at inikv@transforms.posthyphenation}{%
   \bbl at transforms\babelposthyphenation}
-\def\bbl at transforms@aux#1#2#3,#4\relax{#1{#2}{#3}{#4}}
+\def\bbl at 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
@@ -10687,7 +10763,7 @@
   \gdef\bbl at transforms#1#2#3{&%
     \ifx\bbl at 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 @@
       \ifin@
         \in@{.0$}{#2$}&%
         \ifin@
-           \g at addto@macro\bbl at release@transforms{&%
-              \relax\bbl at transforms@aux#1{\languagename}{#3}}&%
+          \directlua{
+            local str = string.match([[\bbl at KVP@transforms]],
+                          '%(([^%(]-)%)[^%)]-\babeltempa')
+            if str == nil then
+              tex.print([[\def\string\babeltempb{}]])
+            else
+              tex.print([[\def\string\babeltempb{,attribute=]] .. str .. [[}]])
+            end
+          }
+          \toks@{#3}&%
+          \bbl at exp{&%
+            \\\g at addto@macro\\\bbl at release@transforms{&%
+              \relax  &% Closes previous \bbl at transforms@aux
+              \\\bbl at transforms@aux
+                \\#1{label=\babeltempa\babeltempb}{\languagename}{\the\toks@}}}&%
         \else
-           \g at addto@macro\bbl at release@transforms{, {#3}}&%
+          \g at addto@macro\bbl at release@transforms{, {#3}}&%
         \fi
       \fi
     \fi}
@@ -14212,13 +14301,21 @@
 \catcode`\~=12
 \catcode`\%=12
 \catcode`\&=14
-\gdef\babelposthyphenation#1#2#3{&%
-  \bbl at activateposthyphen
+\gdef\babelprehyphenation{&%
+  \@ifnextchar[{\bbl at settransform{0}}{\bbl at settransform{0}[]}}
+\gdef\babelposthyphenation{&%
+  \@ifnextchar[{\bbl at settransform{1}}{\bbl at settransform{1}[]}}
+\gdef\bbl at settransform#1[#2]#3#4#5{&%
+  \ifcase#1
+    \bbl at activateprehyphen
+  \else
+    \bbl at activateposthyphen
+  \fi
   \begingroup
     \def\babeltempa{\bbl at add@list\babeltempb}&%
     \let\babeltempb\@empty
-    \def\bbl at tempa{#3}&% TODO. Ugly trick to preserve {}:
-    \bbl at replace\bbl at tempa{,}{ ,}&%
+    \def\bbl at tempa{#5}&%
+    \bbl at replace\bbl at tempa{,}{ ,}&% TODO. Ugly trick to preserve {}
     \expandafter\bbl at foreach\expandafter{\bbl at tempa}{&%
       \bbl at ifsamestring{##1}{remove}&%
         {\bbl at add@list\babeltempb{nil}}&%
@@ -14226,24 +14323,56 @@
            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 at kv@attribute\relax
+    \let\bbl at kv@label\relax
+    \bbl at forkv{#2}{\bbl at csarg\edef{kv@##1}{##2}}&%
+    \ifx\bbl at kv@attribute\relax\else
+      \edef\bbl at kv@attribute{\expandafter\bbl at stripslash\bbl at 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 at id@@#3\endcsname\space
+      else
+        id = \the\csname l@#3\endcsname\space
+      end
+      \ifx\bbl at kv@attribute\relax
+        attr = -1
+      \else
+        attr = luatexbase.registernumber'\bbl at kv@attribute'
+      \fi
+      \ifx\bbl at kv@label\relax\else  &% Same refs:
+        label = [==[\bbl at 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)
@@ -14250,58 +14379,12 @@
       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 at activateprehyphen
-  \begingroup
-    \def\babeltempa{\bbl at add@list\babeltempb}&%
-    \let\babeltempb\@empty
-    \def\bbl at tempa{#3}&% TODO. Ugly trick to preserve {}:
-    \bbl at replace\bbl at tempa{,}{ ,}&%
-    \expandafter\bbl at foreach\expandafter{\bbl at tempa}{&%
-      \bbl at ifsamestring{##1}{remove}&%
-        {\bbl at 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 at 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 at activateposthyphen{%
   \let\bbl at activateposthyphen\relax
@@ -14867,6 +14950,7 @@
     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 @@
         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 @@
             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
 

Modified: trunk/Master/texmf-dist/source/latex/babel/babel.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/babel/babel.ins	2021-11-29 21:11:43 UTC (rev 61185)
+++ trunk/Master/texmf-dist/source/latex/babel/babel.ins	2021-11-29 21:13:12 UTC (rev 61186)
@@ -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
 

Modified: trunk/Master/texmf-dist/source/latex/babel/bbcompat.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/babel/bbcompat.dtx	2021-11-29 21:11:43 UTC (rev 61185)
+++ trunk/Master/texmf-dist/source/latex/babel/bbcompat.dtx	2021-11-29 21:13:12 UTC (rev 61186)
@@ -30,7 +30,7 @@
 %
 % \iffalse
 %<*dtx>
-\ProvidesFile{bbcompat.dtx}[2021/11/08 v3.66]
+\ProvidesFile{bbcompat.dtx}[2021/11/29 v3.67]
 %</dtx>
 %
 %% File 'bbcompat.dtx'

Modified: trunk/Master/texmf-dist/source/latex/babel/locale.zip
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel-transforms.lua
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel-transforms.lua	2021-11-29 21:11:43 UTC (rev 61185)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel-transforms.lua	2021-11-29 21:13:12 UTC (rev 61186)
@@ -209,6 +209,7 @@
     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 @@
         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 @@
             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
 

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel.def
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel.def	2021-11-29 21:11:43 UTC (rev 61185)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel.def	2021-11-29 21:13:12 UTC (rev 61186)
@@ -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 at single\endcsname
 \chardef\bbl at bidimode\z@
 \fi
-\def\bbl at version{3.66}
-\def\bbl at date{2021/11/08}
+\def\bbl at version{3.67}
+\def\bbl at date{2021/11/29}
 \ifx\language\@undefined
   \csname newcount\endcsname\language
 \fi
@@ -620,7 +620,10 @@
 \newif\ifbbl at bcpallowed
 \bbl at bcpallowedfalse
 \def\select at language#1{% from set@, babel at aux
+  \ifx\bbl at selectorname\@empty
+    \def\bbl at selectorname{select}%
   % set hymap
+  \fi
   \ifnum\bbl at hymapsel=\@cclv\chardef\bbl at hymapsel4\relax\fi
   % set name
   \edef\languagename{#1}%
@@ -730,8 +733,10 @@
   \else
     \expandafter\expandafter\expandafter\set at hyphenmins
       \csname #1hyphenmins\endcsname\relax
-  \fi}
+  \fi
+  \let\bbl at selectorname\@empty}
 \long\def\otherlanguage#1{%
+  \def\bbl at selectorname{other}%
   \ifnum\bbl at hymapsel=\@cclv\let\bbl at hymapsel\thr@@\fi
   \csname selectlanguage \endcsname{#1}%
   \ignorespaces}
@@ -740,6 +745,7 @@
 \expandafter\def\csname otherlanguage*\endcsname{%
   \@ifnextchar[\bbl at otherlanguage@s{\bbl at otherlanguage@s[]}}
 \def\bbl at otherlanguage@s[#1]#2{%
+  \def\bbl at selectorname{other*}%
   \ifnum\bbl at hymapsel=\@cclv\chardef\bbl at hymapsel4\relax\fi
   \def\bbl at select@opts{#1}%
   \foreign at language{#2}}
@@ -752,6 +758,7 @@
   \@ifstar\bbl at foreign@s\bbl at foreign@x}
 \providecommand\bbl at foreign@x[3][]{%
   \begingroup
+    \def\bbl at selectorname{foreign}%
     \def\bbl at select@opts{#1}%
     \let\BabelText\@firstofone
     \bbl at beforeforeign
@@ -762,6 +769,7 @@
 \def\bbl at foreign@s#1#2{% TODO - \shapemode, \@setpar, ?\@@par
   \begingroup
     {\par}%
+    \def\bbl at selectorname{foreign*}%
     \let\bbl at select@opts\@empty
     \let\BabelText\@firstofone
     \foreign at language{#1}%
@@ -794,6 +802,13 @@
     % set type
     \let\bbl at select@type\@ne
     \expandafter\bbl at switch\expandafter{\languagename}}}
+\def\IfBabelSelectorTF#1{%
+  \bbl at xin@{,\bbl at selectorname,}{,\zap at space#1 \@empty,}%
+  \ifin@
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi}
 \let\bbl at hyphlist\@empty
 \let\bbl at hyphenation@\relax
 \let\bbl at 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,7 +3359,8 @@
   \bbl at transforms\babelprehyphenation}
 \@namedef{bbl at inikv@transforms.posthyphenation}{%
   \bbl at transforms\babelposthyphenation}
-\def\bbl at transforms@aux#1#2#3,#4\relax{#1{#2}{#3}{#4}}
+\def\bbl at 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
@@ -3352,7 +3367,7 @@
   \gdef\bbl at transforms#1#2#3{&%
     \ifx\bbl at 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 at addto@macro\bbl at release@transforms{&%
-              \relax\bbl at transforms@aux#1{\languagename}{#3}}&%
+          \directlua{
+            local str = string.match([[\bbl at KVP@transforms]],
+                          '%(([^%(]-)%)[^%)]-\babeltempa')
+            if str == nil then
+              tex.print([[\def\string\babeltempb{}]])
+            else
+              tex.print([[\def\string\babeltempb{,attribute=]] .. str .. [[}]])
+            end
+          }
+          \toks@{#3}&%
+          \bbl at exp{&%
+            \\\g at addto@macro\\\bbl at release@transforms{&%
+              \relax  &% Closes previous \bbl at transforms@aux
+              \\\bbl at transforms@aux
+                \\#1{label=\babeltempa\babeltempb}{\languagename}{\the\toks@}}}&%
         \else
-           \g at addto@macro\bbl at release@transforms{, {#3}}&%
+          \g at addto@macro\bbl at release@transforms{, {#3}}&%
         \fi
       \fi
     \fi}

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel.sty
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel.sty	2021-11-29 21:11:43 UTC (rev 61185)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel.sty	2021-11-29 21:13:12 UTC (rev 61186)
@@ -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 at trace[1]{\message{^^J[ #1 ]}}%
    \let\bbl at debug\@firstofone
@@ -458,8 +458,8 @@
       \expandafter\@secondoftwo
     \fi}
 \fi
-\def\bbl at version{3.66}
-\def\bbl at date{2021/11/08}
+\def\bbl at version{3.67}
+\def\bbl at date{2021/11/29}
 \ifx\language\@undefined
   \csname newcount\endcsname\language
 \fi
@@ -672,7 +672,10 @@
 \newif\ifbbl at bcpallowed
 \bbl at bcpallowedfalse
 \def\select at language#1{% from set@, babel at aux
+  \ifx\bbl at selectorname\@empty
+    \def\bbl at selectorname{select}%
   % set hymap
+  \fi
   \ifnum\bbl at hymapsel=\@cclv\chardef\bbl at hymapsel4\relax\fi
   % set name
   \edef\languagename{#1}%
@@ -782,8 +785,10 @@
   \else
     \expandafter\expandafter\expandafter\set at hyphenmins
       \csname #1hyphenmins\endcsname\relax
-  \fi}
+  \fi
+  \let\bbl at selectorname\@empty}
 \long\def\otherlanguage#1{%
+  \def\bbl at selectorname{other}%
   \ifnum\bbl at hymapsel=\@cclv\let\bbl at hymapsel\thr@@\fi
   \csname selectlanguage \endcsname{#1}%
   \ignorespaces}
@@ -792,6 +797,7 @@
 \expandafter\def\csname otherlanguage*\endcsname{%
   \@ifnextchar[\bbl at otherlanguage@s{\bbl at otherlanguage@s[]}}
 \def\bbl at otherlanguage@s[#1]#2{%
+  \def\bbl at selectorname{other*}%
   \ifnum\bbl at hymapsel=\@cclv\chardef\bbl at hymapsel4\relax\fi
   \def\bbl at select@opts{#1}%
   \foreign at language{#2}}
@@ -804,6 +810,7 @@
   \@ifstar\bbl at foreign@s\bbl at foreign@x}
 \providecommand\bbl at foreign@x[3][]{%
   \begingroup
+    \def\bbl at selectorname{foreign}%
     \def\bbl at select@opts{#1}%
     \let\BabelText\@firstofone
     \bbl at beforeforeign
@@ -814,6 +821,7 @@
 \def\bbl at foreign@s#1#2{% TODO - \shapemode, \@setpar, ?\@@par
   \begingroup
     {\par}%
+    \def\bbl at selectorname{foreign*}%
     \let\bbl at select@opts\@empty
     \let\BabelText\@firstofone
     \foreign at language{#1}%
@@ -846,6 +854,13 @@
     % set type
     \let\bbl at select@type\@ne
     \expandafter\bbl at switch\expandafter{\languagename}}}
+\def\IfBabelSelectorTF#1{%
+  \bbl at xin@{,\bbl at selectorname,}{,\zap at space#1 \@empty,}%
+  \ifin@
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi}
 \let\bbl at hyphlist\@empty
 \let\bbl at hyphenation@\relax
 \let\bbl at 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,7 +3411,8 @@
   \bbl at transforms\babelprehyphenation}
 \@namedef{bbl at inikv@transforms.posthyphenation}{%
   \bbl at transforms\babelposthyphenation}
-\def\bbl at transforms@aux#1#2#3,#4\relax{#1{#2}{#3}{#4}}
+\def\bbl at 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
@@ -3404,7 +3419,7 @@
   \gdef\bbl at transforms#1#2#3{&%
     \ifx\bbl at 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 at addto@macro\bbl at release@transforms{&%
-              \relax\bbl at transforms@aux#1{\languagename}{#3}}&%
+          \directlua{
+            local str = string.match([[\bbl at KVP@transforms]],
+                          '%(([^%(]-)%)[^%)]-\babeltempa')
+            if str == nil then
+              tex.print([[\def\string\babeltempb{}]])
+            else
+              tex.print([[\def\string\babeltempb{,attribute=]] .. str .. [[}]])
+            end
+          }
+          \toks@{#3}&%
+          \bbl at exp{&%
+            \\\g at addto@macro\\\bbl at release@transforms{&%
+              \relax  &% Closes previous \bbl at transforms@aux
+              \\\bbl at transforms@aux
+                \\#1{label=\babeltempa\babeltempb}{\languagename}{\the\toks@}}}&%
         \else
-           \g at addto@macro\bbl at release@transforms{, {#3}}&%
+          \g at addto@macro\bbl at release@transforms{, {#3}}&%
         \fi
       \fi
     \fi}

Modified: trunk/Master/texmf-dist/tex/generic/babel/hyphen.cfg
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/hyphen.cfg	2021-11-29 21:11:43 UTC (rev 61185)
+++ trunk/Master/texmf-dist/tex/generic/babel/hyphen.cfg	2021-11-29 21:13:12 UTC (rev 61186)
@@ -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 at format{\jobname}
-\def\bbl at version{3.66}
-\def\bbl at date{2021/11/08}
+\def\bbl at version{3.67}
+\def\bbl at date{2021/11/29}
 \ifx\AtBeginDocument\@undefined
   \def\@empty{}
 \fi

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/la/babel-la-x-classic.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/la/babel-la-x-classic.ini	2021-11-29 21:11:43 UTC (rev 61185)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/la/babel-la-x-classic.ini	2021-11-29 21:13:12 UTC (rev 61186)
@@ -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 @@
 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} }

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/la/babel-la-x-ecclesia.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/la/babel-la-x-ecclesia.ini	2021-11-29 21:11:43 UTC (rev 61185)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/la/babel-la-x-ecclesia.ini	2021-11-29 21:13:12 UTC (rev 61186)
@@ -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 @@
 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} }

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/la/babel-la-x-medieval.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/la/babel-la-x-medieval.ini	2021-11-29 21:11:43 UTC (rev 61185)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/la/babel-la-x-medieval.ini	2021-11-29 21:13:12 UTC (rev 61186)
@@ -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 @@
 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} }

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/la/babel-la.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/la/babel-la.ini	2021-11-29 21:11:43 UTC (rev 61185)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/la/babel-la.ini	2021-11-29 21:13:12 UTC (rev 61186)
@@ -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 @@
 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} }
+

Modified: trunk/Master/texmf-dist/tex/generic/babel/luababel.def
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/luababel.def	2021-11-29 21:11:43 UTC (rev 61185)
+++ trunk/Master/texmf-dist/tex/generic/babel/luababel.def	2021-11-29 21:13:12 UTC (rev 61186)
@@ -1138,13 +1138,21 @@
 \catcode`\~=12
 \catcode`\%=12
 \catcode`\&=14
-\gdef\babelposthyphenation#1#2#3{&%
-  \bbl at activateposthyphen
+\gdef\babelprehyphenation{&%
+  \@ifnextchar[{\bbl at settransform{0}}{\bbl at settransform{0}[]}}
+\gdef\babelposthyphenation{&%
+  \@ifnextchar[{\bbl at settransform{1}}{\bbl at settransform{1}[]}}
+\gdef\bbl at settransform#1[#2]#3#4#5{&%
+  \ifcase#1
+    \bbl at activateprehyphen
+  \else
+    \bbl at activateposthyphen
+  \fi
   \begingroup
     \def\babeltempa{\bbl at add@list\babeltempb}&%
     \let\babeltempb\@empty
-    \def\bbl at tempa{#3}&% TODO. Ugly trick to preserve {}:
-    \bbl at replace\bbl at tempa{,}{ ,}&%
+    \def\bbl at tempa{#5}&%
+    \bbl at replace\bbl at tempa{,}{ ,}&% TODO. Ugly trick to preserve {}
     \expandafter\bbl at foreach\expandafter{\bbl at tempa}{&%
       \bbl at ifsamestring{##1}{remove}&%
         {\bbl at add@list\babeltempb{nil}}&%
@@ -1152,69 +1160,55 @@
            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 at kv@attribute\relax
+    \let\bbl at kv@label\relax
+    \bbl at forkv{#2}{\bbl at csarg\edef{kv@##1}{##2}}&%
+    \ifx\bbl at kv@attribute\relax\else
+      \edef\bbl at kv@attribute{\expandafter\bbl at stripslash\bbl at 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 at id@@#3\endcsname\space
+      else
+        id = \the\csname l@#3\endcsname\space
+      end
+      \ifx\bbl at kv@attribute\relax
+        attr = -1
+      \else
+        attr = luatexbase.registernumber'\bbl at kv@attribute'
+      \fi
+      \ifx\bbl at kv@label\relax\else  &% Same refs:
+        label = [==[\bbl at kv@label]==]
+      \fi
       &% Convert pattern:
-      local patt = string.gsub([==[#2]==], '%s', '')
-      if not u.find(patt, '()', nil, true) then
-        patt = '()' .. patt .. '()'
+      local patt = string.gsub([==[#4]==], '%s', '')
+      if #1 == 0 then
+        patt = string.gsub(patt, '|', ' ')
       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 at activateprehyphen
-  \begingroup
-    \def\babeltempa{\bbl at add@list\babeltempb}&%
-    \let\babeltempb\@empty
-    \def\bbl at tempa{#3}&% TODO. Ugly trick to preserve {}:
-    \bbl at replace\bbl at tempa{,}{ ,}&%
-    \expandafter\bbl at foreach\expandafter{\bbl at tempa}{&%
-      \bbl at ifsamestring{##1}{remove}&%
-        {\bbl at 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 at 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()$')
+      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 @@
                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

Modified: trunk/Master/texmf-dist/tex/generic/babel/nil.ldf
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/nil.ldf	2021-11-29 21:11:43 UTC (rev 61185)
+++ trunk/Master/texmf-dist/tex/generic/babel/nil.ldf	2021-11-29 21:13:12 UTC (rev 61186)
@@ -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 at nil\@undefined
   \newlanguage\l at nil



More information about the tex-live-commits mailing list.