[latex3-commits] [git/LaTeX3-latex3-babel] master: A few improvements in \babel(pre|post)hyphenation. Fix #104, #109. (0b4151f)
Javier
email at dante.de
Thu Nov 26 17:13:55 CET 2020
Repository : https://github.com/latex3/babel
On branch : master
Link : https://github.com/latex3/babel/commit/0b4151f15f17c19c3c95f37b4a3d716b66dc9bd9
>---------------------------------------------------------------
commit 0b4151f15f17c19c3c95f37b4a3d716b66dc9bd9
Author: Javier <email at localhost>
Date: Thu Nov 26 17:13:55 2020 +0100
A few improvements in \babel(pre|post)hyphenation. Fix #104, #109.
>---------------------------------------------------------------
0b4151f15f17c19c3c95f37b4a3d716b66dc9bd9
README.md | 5 ++-
babel.dtx | 95 +++++++++++++++++++++++++------------------------
babel.ins | 2 +-
babel.pdf | Bin 815893 -> 816356 bytes
bbcompat.dtx | 2 +-
locale/sq/babel-sq.ini | 6 ++--
6 files changed, 57 insertions(+), 53 deletions(-)
diff --git a/README.md b/README.md
index fccd8fb..34532c2 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-## Babel 3.51.2200
+## Babel 3.51.2203
This package manages culturally-determined typographical (and other)
rules, and hyphenation patterns for a wide range of languages. Many
@@ -48,6 +48,9 @@ respective authors.
- Fixes:
- A couple of issues with \localeinfo and \getlocaleproperty
(#102, #105).
+ - Save size overflow with many \selectlanguage's (#109).
+ - Albanian: fix a typo in contents name (#104)
+
3.51 2020-10-27
- Common interface to (re)define captions (with
\setlocalecaption).
diff --git a/babel.dtx b/babel.dtx
index 72c0f43..6bb0f96 100644
--- a/babel.dtx
+++ b/babel.dtx
@@ -31,7 +31,7 @@
%
% \iffalse
%<*filedriver>
-\ProvidesFile{babel.dtx}[2020/11/23 v3.51.2200 The Babel package]
+\ProvidesFile{babel.dtx}[2020/11/26 v3.51.2203 The Babel package]
\documentclass{ltxdoc}
\GetFileInfo{babel.dtx}
\usepackage{fontspec}
@@ -4823,8 +4823,8 @@ help from Bernd Raichle, for which I am grateful.
% \section{Tools}
%
% \begin{macrocode}
-%<<version=3.51.2200>>
-%<<date=2020/11/23>>
+%<<version=3.51.2203>>
+%<<date=2020/11/26>>
% \end{macrocode}
%
% \textbf{Do not use the following macros in \texttt{ldf} files. They
@@ -7490,7 +7490,7 @@ help from Bernd Raichle, for which I am grateful.
\csname\languagename @bbl at hyphenmap\endcsname
\fi
\fi
- \global\let\bbl at hymapsel\@cclv
+ \let\bbl at hymapsel\@cclv
% hyphenation - select patterns
\bbl at patterns{#1}%
% hyphenation - allow stretching with babelnohyphens
@@ -13807,11 +13807,14 @@ end
break
end
- &% For each saved posthyphen
+ &% For each saved (pre|post)hyphenation
for k=1, #lbkr[lang] do
local p = lbkr[lang][k].pattern
local r = lbkr[lang][k].replace
+ &% This variable is set in some cases below to the first *byte*
+ &% after the match, either as found by u.match (faster) or the
+ &% computed position based on sc if w has changed.
local last_match = 0
&% For every match.
@@ -13834,21 +13837,23 @@ end
last = u.len(w:sub(1, last-1)) &% now last points to C
if Babel.debug then
+ print(p)
print('', 'sc', 'first', 'last', 'last_m', 'w')
end
&% This loop traverses the matched substring and takes the
&% corresponding action stored in the replacement list.
- &% sc is the position in substr nodes / string
- &% rc is the replacement table index
- sc = first-1
- rc = 0
- while rc < last-first+1 do
+ &% sc = the position in substr nodes / string
+ &% rc = the replacement table index
+ local sc = first-1
+ local rc = 0
+ while rc < last-first+1 do &% for each replacement
sc = sc + 1
rc = rc + 1
local crep = r[rc]
local char_node = wn[sc]
local char_base = char_node
+ local end_replacement = false
if crep and crep.data then
char_base = wn[crep.data+first-1]
@@ -13859,17 +13864,17 @@ end
end
if crep and next(crep) == nil then &% {}
- &% pass
+ last_match = save_last
elseif crep == nil then &% remove
node.remove(head, char_node)
table.remove(wn, sc)
w = u.sub(w, 1, sc-1) .. u.sub(w, sc+1)
last_match = utf8.offset(w, sc)
- sc = sc - 1
+ sc = sc - 1 &% Nothing has been inserted
elseif mode == 1 and crep and (crep.pre or crep.no or crep.post) then
- d = node.new(7, 0) &% (disc, discretionary)
+ local d = node.new(7, 0) &% (disc, discretionary)
d.pre = Babel.str_to_nodes(crep.pre, matches, char_base)
d.post = Babel.str_to_nodes(crep.post, matches, char_base)
d.replace = Babel.str_to_nodes(crep.no, matches, char_base)
@@ -13880,49 +13885,27 @@ end
d.penalty = crep.penalty or tex.exhyphenpenalty
end
head, new = node.insert_before(head, char_node, d)
- if sc == 1 then
- word_head = new
- end
- if crep.insert then
- last_match = save_last
- else
- node.remove(head, char_node)
- table.remove(wn, sc)
- w = u.sub(w, 1, sc-1) .. u.sub(w, sc+1)
- last_match = utf8.offset(w, sc)
- end
+ end_replacement = true
- elseif mode == 0 and crep and crep.penalty then
- d = node.new(14, 0) &% (penalty, userpenalty)
- d.attr = char_base.attr
- d.penalty = crep.penalty
- head, new = node.insert_before(head, char_node, d)
- if sc == 1 then
- word_head = new
- end
- if crep.insert then
- last_match = save_last &% is utf8.offset(w, sc+1) ok?
- else
- node.remove(head, char_node)
- table.remove(wn, sc)
- w = u.sub(w, 1, sc-1) .. u.sub(w, sc+1)
- last_match = utf8.offset(w, sc)
- end
+ elseif crep and crep.penalty then
+ local d = node.new(14, 0) &% (penalty, userpenalty)
+ d.attr = char_base.attr
+ d.penalty = crep.penalty
+ head, new = node.insert_before(head, char_node, d)
+ end_replacement = true
elseif crep and crep.string then
local str = crep.string(matches)
- if str == '' then
+ if str == '' then &% Gather with nil
refetch = true
if sc == 1 then
word_head = char_node.next
end
head, new = node.remove(head, char_node)
elseif char_node.id == 29 and u.len(str) == 1 then
- &% For one-to-one can we modifiy directly the
- &% values without re-fetching.
char_node.char = string.utfvalue(str)
w = u.sub(w, 1, sc-1) .. str .. u.sub(w, sc+1)
- last_match = save_last &% utf8.offset(w, sc)
+ last_match = utf8.offset(w, sc+1)
else
refetch = true
local n
@@ -13940,11 +13923,27 @@ end
node.insert_before(head, char_node, n)
end
end
-
node.remove(head, char_node)
end &% string length
- end &% if char and char.string
- end &% for char in match
+ end &% if char and char.string (ie replacement cases)
+
+ &% Shared by disc and penalty. With them, the inserted item
+ &% does NOT go to w because it's neither = nor | nor a
+ &% char.
+ if end_replacement then
+ if sc == 1 then
+ word_head = new
+ end
+ if crep.insert then
+ last_match = save_last
+ else
+ node.remove(head, char_node)
+ table.remove(wn, sc)
+ w = u.sub(w, 1, sc-1) .. u.sub(w, sc+1)
+ last_match = utf8.offset(w, sc)
+ end
+ end
+ end &% for each replacement
if Babel.debug then
print('/', sc, first, last, last_match, w)
@@ -14072,6 +14071,8 @@ end
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)
diff --git a/babel.ins b/babel.ins
index 7cc69b8..1508d92 100644
--- a/babel.ins
+++ b/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{2020/11/23}
+\def\filedate{2020/11/26}
\def\batchfile{babel.ins}
\input docstrip.tex
diff --git a/babel.pdf b/babel.pdf
index 8f7407e..8303c22 100644
Binary files a/babel.pdf and b/babel.pdf differ
diff --git a/bbcompat.dtx b/bbcompat.dtx
index b979db5..fb2a0e0 100644
--- a/bbcompat.dtx
+++ b/bbcompat.dtx
@@ -30,7 +30,7 @@
%
% \iffalse
%<*dtx>
-\ProvidesFile{bbcompat.dtx}[2020/11/23 v3.51.2200]
+\ProvidesFile{bbcompat.dtx}[2020/11/26 v3.51.2203]
%</dtx>
%
%% File 'bbcompat.dtx'
diff --git a/locale/sq/babel-sq.ini b/locale/sq/babel-sq.ini
index 1ae7393..3b8c892 100644
--- a/locale/sq/babel-sq.ini
+++ b/locale/sq/babel-sq.ini
@@ -11,8 +11,8 @@
[identification]
charset = utf8
-version = 1.2
-date = 2020-06-30
+version = 1.3
+date = 2020-11-25
name.local = shqip
name.english = Albanian
name.babel = albanian
@@ -35,7 +35,7 @@ abstract = Përmbledhja
bib = Bibliografia
chapter = Kapitulli
appendix = Shtesa
-contents = Përmbajta
+contents = Përmbajtja
listfigure = Figurat
listtable = Tabelat
index = Indeksi
More information about the latex3-commits
mailing list.