summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/babel
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2023-07-09 19:49:07 +0000
committerKarl Berry <karl@freefriends.org>2023-07-09 19:49:07 +0000
commitce68c1acd66bd646f4b9464ccd172b7d18342a35 (patch)
treee66ccbba7fc5a63bdfcf807967ba69e41c23a761 /Master/texmf-dist/source/latex/babel
parentbc9a53d94ea0ed13ea9416ab2c16492f6b1016fb (diff)
babel (9jul23)
git-svn-id: svn://tug.org/texlive/trunk@67592 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/babel')
-rw-r--r--Master/texmf-dist/source/latex/babel/babel.dtx92
-rw-r--r--Master/texmf-dist/source/latex/babel/babel.ins2
-rw-r--r--Master/texmf-dist/source/latex/babel/bbcompat.dtx2
-rw-r--r--Master/texmf-dist/source/latex/babel/locale.zipbin941853 -> 942671 bytes
4 files changed, 74 insertions, 22 deletions
diff --git a/Master/texmf-dist/source/latex/babel/babel.dtx b/Master/texmf-dist/source/latex/babel/babel.dtx
index 1477fd04499..6f91f1141cc 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}[2023/06/26 v3.90 The Babel package]
+\ProvidesFile{babel.dtx}[2023/07/09 v3.91 The Babel package]
\documentclass{ltxdoc}
\GetFileInfo{babel.dtx}
\usepackage{fontspec}
@@ -2941,7 +2941,7 @@ Languages providing native digits in all or some variants are:
Arabic\\
Assamese\\
Bangla\\
-Tibetar\\
+Tibetan\\
Bodo\\
Central Kurdish\\
Dzongkha\\
@@ -5466,8 +5466,8 @@ wouldn’t exist.
% \section{Tools}
%
% \begin{macrocode}
-%<<version=3.90>>
-%<<date=2023/06/26>>
+%<<version=3.91>>
+%<<date=2023/07/09>>
% \end{macrocode}
%
% \textbf{Do not use the following macros in \texttt{ldf} files. They
@@ -14436,13 +14436,8 @@ end
\gdef\bbl@arabicjust{%
\let\bbl@arabicjust\relax
\newattribute\bblar@kashida
- \newattribute\bblar@kashida@aux % 0, 1=tatweel, 2=diacritics
- \directlua{% WIP
- Babel.attr_kashida = luatexbase.registernumber'bblar@kashida'
- Babel.attr_kashida_aux = luatexbase.registernumber'bblar@kashida@aux'
- }%
+ \directlua{ Babel.attr_kashida = luatexbase.registernumber'bblar@kashida' }%
\bblar@kashida=\z@
- \bblar@kashida@aux=\z@
\bbl@patchfont{{\bbl@parsejalt}}%
\directlua{
Babel.arabic.elong_map = Babel.arabic.elong_map or {}
@@ -14904,7 +14899,6 @@ end
\@ifnextchar[{\bbl@settransform{0}}{\bbl@settransform{0}[]}}
\gdef\babelposthyphenation{&%
\@ifnextchar[{\bbl@settransform{1}}{\bbl@settransform{1}[]}}
-\gdef\bbl@postlinebreak{\bbl@settransform{2}[]} &% WIP
\gdef\bbl@settransform#1[#2]#3#4#5{&%
\ifcase#1
\bbl@activateprehyphen
@@ -14985,7 +14979,7 @@ end
local lbkr = Babel.linebreaking.replacements[#1]
local u = unicode.utf8
local id, attr, label
- if #1 == 0 or #1 == 2 then
+ if #1 == 0 then
id = \the\csname bbl@id@@#3\endcsname\space
else
id = \the\csname l@#3\endcsname\space
@@ -15000,7 +14994,7 @@ end
\fi
&% Convert pattern:
local patt = string.gsub([==[#4]==], '%s', '')
- if #1 == 0 or #1 == 2 then
+ if #1 == 0 then
patt = string.gsub(patt, '|', ' ')
end
if not u.find(patt, '()', nil, true) then
@@ -15081,6 +15075,19 @@ end
}}
% \end{macrocode}
%
+% The following experimental (and unfinished) macro applies the
+% prehyphenation transforms for the current locale to a string
+% (characters and spaces) and processes it in a fully expandable way
+% (among other limitations, the string can’t contain |]==]|). The way
+% it operates is admittedly rather cumbersome: it converts the string
+% to a node list, processes it, and converts it back to a string. The
+% lua code is in the lua file below.
+%
+% \begin{macrocode}
+\newcommand\localeprehyphenation[1]{%
+ \directlua{ Babel.string_prehyphenation([==[#1]==], \the\localeid) }}
+% \end{macrocode}
+%
% \subsection{Bidi}
%
% As a first step, add a handler for bidi and digits (and potentially
@@ -15376,10 +15383,13 @@ end
\AddToHook{env/gather*/begin}{\bbl@ams@preset\bbl@ams@lap}%
\AddToHook{env/align/begin}{\bbl@ams@preset\bbl@ams@lap}%
\AddToHook{env/align*/begin}{\bbl@ams@preset\bbl@ams@lap}%
+ \AddToHook{env/alignat/begin}{\bbl@ams@preset\bbl@ams@lap}%
+ \AddToHook{env/alignat*/begin}{\bbl@ams@preset\bbl@ams@lap}%
\AddToHook{env/eqnalign/begin}{\bbl@ams@preset\hbox}%
% Hackish, for proper alignment. Don’t ask me why it works!:
\bbl@exp{% Avoid a 'visible' conditional
- \\\AddToHook{env/align*/end}{\<iftag@>\<else>\\\tag*{}\<fi>}}%
+ \\\AddToHook{env/align*/end}{\<iftag@>\<else>\\\tag*{}\<fi>}%
+ \\\AddToHook{env/alignat*/end}{\<iftag@>\<else>\\\tag*{}\<fi>}}%
\AddToHook{env/flalign/begin}{\bbl@ams@preset\hbox}%
\AddToHook{env/split/before}{%
\def\bbl@mathboxdir{\def\bbl@insidemath{1}}%
@@ -15488,11 +15498,23 @@ end
{}}%
\fi}
\fi
+% \end{macrocode}
+%
+% Very likely the |\output| routine must be patched in a quite general
+% way to make sure the |\bodydir| is set to |\pagedir|. Note outside
+% |\output| they can be different (and often are). For the moment, two
+% \textit{ad hoc} changes.
+%
+% \begin{macrocode}
\AtBeginDocument{%
\@ifpackageloaded{multicol}%
{\toks@\expandafter{\multi@column@out}%
\edef\multi@column@out{\bodydir\pagedir\the\toks@}}%
- {}}
+ {}%
+ \@ifpackageloaded{paracol}%
+ {\edef\pcol@output{%
+ \bodydir\pagedir\unexpanded\expandafter{\pcol@output}}}%
+ {}}%
\fi
\ifx\bbl@opt@layout\@nnil\endinput\fi % if no layout
% \end{macrocode}
@@ -15684,9 +15706,12 @@ end
%
% \begin{macrocode}
\IfBabelLayout{extras}%
- {\let\bbl@OL@underline\underline
- \bbl@sreplace\underline{$\@@underline}{\bbl@nextfake$\@@underline}%
- \let\bbl@OL@LaTeX2e\LaTeX2e
+ {\bbl@ncarg\let\bbl@OL@underline{underline }%
+ \bbl@carg\bbl@sreplace{underline }%
+ {$\@@underline}{\bgroup\bbl@nextfake$\@@underline}%
+ \bbl@carg\bbl@sreplace{underline }%
+ {\m@th$}{\m@th$\egroup}%
+ \let\bbl@OL@LaTeXe\LaTeXe
\DeclareRobustCommand{\LaTeXe}{\mbox{\m@th
\if b\expandafter\@car\f@series\@nil\boldmath\fi
\babelsublr{%
@@ -15720,7 +15745,6 @@ end
Babel.linebreaking.replacements = {}
Babel.linebreaking.replacements[0] = {} -- pre
Babel.linebreaking.replacements[1] = {} -- post
-Babel.linebreaking.replacements[2] = {} -- post-line WIP
-- Discretionaries contain strings as nodes
function Babel.str_to_nodes(fn, matches, base)
@@ -15872,7 +15896,6 @@ Babel.us_char = string.char(31)
function Babel.hyphenate_replace(head, mode)
local u = unicode.utf8
local lbkr = Babel.linebreaking.replacements[mode]
- if mode == 2 then mode = 0 end -- WIP
local word_head = head
@@ -16203,6 +16226,35 @@ function Babel.capture_kashida(key, wt)
end
return 'kashida = ' .. wt
end
+
+-- Experimental: applies prehyphenation transforms to a string (letters
+-- and spaces).
+function Babel.string_prehyphenation(str, locale)
+ local n, head, last, res
+ head = node.new(8, 0) -- dummy (hack just to start)
+ last = head
+ for s in string.utfvalues(str) do
+ if s == 20 then
+ n = node.new(12, 0)
+ else
+ n = node.new(29, 0)
+ n.char = s
+ end
+ node.set_attribute(n, Babel.attr_locale, locale)
+ last.next = n
+ last = n
+ end
+ head = Babel.hyphenate_replace(head, 0)
+ res = ''
+ for n in node.traverse(head) do
+ if n.id == 12 then
+ res = res .. ' '
+ elseif n.id == 29 then
+ res = res .. unicode.utf8.char(n.char)
+ end
+ end
+ tex.print(res)
+end
%</transforms>
% \end{macrocode}
%
diff --git a/Master/texmf-dist/source/latex/babel/babel.ins b/Master/texmf-dist/source/latex/babel/babel.ins
index 9aae84b3377..0ecbabbcf5e 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{2023/06/26}
+\def\filedate{2023/07/09}
\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 a75572297a6..6aed1294ac3 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}[2023/06/26 v3.90]
+\ProvidesFile{bbcompat.dtx}[2023/07/09 v3.91]
%</dtx>
%
%% File 'bbcompat.dtx'
diff --git a/Master/texmf-dist/source/latex/babel/locale.zip b/Master/texmf-dist/source/latex/babel/locale.zip
index c4a18e81304..db424156901 100644
--- a/Master/texmf-dist/source/latex/babel/locale.zip
+++ b/Master/texmf-dist/source/latex/babel/locale.zip
Binary files differ