From 610482abcae8e36c71a73bc313e0d95b3c50cc46 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcel=20Fabian=20Kr=C3=BCger?=
Date: Sun, 7 Nov 2021 03:28:06 +0100
Subject: [PATCH 1/3] Reclassify [vh]pack_quality callbacks as exclusive
---
base/changes.txt | 5 +++++
base/doc/ltnews35.tex | 8 ++++++++
base/ltluatex.dtx | 8 +++++---
3 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/base/changes.txt b/base/changes.txt
index d5d2b555d..e43914799 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -6,6 +6,11 @@ completeness or accuracy and it contains some references to files that
are not part of the distribution.
================================================================================
+2021-11-17 Marcel Krüger
+
+ * ltluatex.dtx:
+ Classify [hv]pack_quality callbacks as exclusive
+
================================================================================
All changes above are only part of the development branch for the next release.
================================================================================
diff --git a/base/doc/ltnews35.tex b/base/doc/ltnews35.tex
index 731c5ee98..b701339a7 100644
--- a/base/doc/ltnews35.tex
+++ b/base/doc/ltnews35.tex
@@ -147,6 +147,14 @@ \subsection{???}
\section{Code improvements}
+\subsection{Lua\TeX\ callback improvements}
+
+The Lua\TeX\ callbacks \texttt{hpack\_quality} and \texttt{vpack\_quality} are
+now \texttt{exclusive} and therefore only allow a single handler.
+The previous type \texttt{list} resulted in incorrect parameters when multiple
+handlers were set, therefore this only makes an existing restriction more
+explicit.
+
\subsection{???}
%
\githubissue{???}
diff --git a/base/ltluatex.dtx b/base/ltluatex.dtx
index 258ac4829..1f8598ff1 100644
--- a/base/ltluatex.dtx
+++ b/base/ltluatex.dtx
@@ -28,7 +28,7 @@
\ProvidesFile{ltluatex.dtx}
%
%<*tex>
-[2021/10/15 v1.1v
+[2021/11/17 v1.1w
%
% LuaTeX support for plain TeX (core)
%<*tex>
@@ -1351,6 +1351,8 @@ local callbacktypes = callbacktypes or {
% \changes{v1.1k}{2019/10/02}{mlist\_to\_hlist is \texttt{exclusive}}
% \changes{v1.1l}{2020/02/02}{post\_linebreak\_filter is \texttt{reverselist}}
% \changes{v1.1p}{2020/08/01}{new\_graf is \texttt{exclusive}}
+% \changes{v1.1w}{2021/11/17}{hpack\_quality is \texttt{exclusive}}
+% \changes{v1.1w}{2021/11/17}{vpack\_quality is \texttt{exclusive}}
% \begin{macrocode}
contribute_filter = simple,
buildpage_filter = simple,
@@ -1361,8 +1363,8 @@ local callbacktypes = callbacktypes or {
post_linebreak_filter = reverselist,
hpack_filter = list,
vpack_filter = list,
- hpack_quality = list,
- vpack_quality = list,
+ hpack_quality = exclusive,
+ vpack_quality = exclusive,
pre_output_filter = list,
process_rule = exclusive,
hyphenate = simple,
From c038181414defe3b335380cc9521f2c692bd8012 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcel=20Fabian=20Kr=C3=BCger?=
Date: Mon, 8 Nov 2021 09:17:07 +0100
Subject: [PATCH 2/3] Don't return true in LuaTeX list callbacks
---
base/changes.txt | 1 +
base/doc/ltnews35.tex | 5 +++++
base/ltluatex.dtx | 19 ++++++-------------
base/ltshipout.dtx | 5 +++--
base/testfiles/tlb-ltluatex-001.luatex.tlg | 2 +-
5 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/base/changes.txt b/base/changes.txt
index e43914799..79d9ec7eb 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -10,6 +10,7 @@ are not part of the distribution.
* ltluatex.dtx:
Classify [hv]pack_quality callbacks as exclusive
+ Never pass true to the engine for LuaTeX list callbacks
================================================================================
All changes above are only part of the development branch for the next release.
diff --git a/base/doc/ltnews35.tex b/base/doc/ltnews35.tex
index b701339a7..6b5d4816b 100644
--- a/base/doc/ltnews35.tex
+++ b/base/doc/ltnews35.tex
@@ -155,6 +155,11 @@ \subsection{Lua\TeX\ callback improvements}
handlers were set, therefore this only makes an existing restriction more
explicit.
+Additionally the return value \texttt{true} for \texttt{list} callbacks is now
+handled internally and no longer passed on to the engine. This simplifies the
+handling of these callbacks and makes it easier to provide consistent
+interfaces for user defined \texttt{list} callbacks.
+
\subsection{???}
%
\githubissue{???}
diff --git a/base/ltluatex.dtx b/base/ltluatex.dtx
index 1f8598ff1..612e13542 100644
--- a/base/ltluatex.dtx
+++ b/base/ltluatex.dtx
@@ -1518,11 +1518,11 @@ end
% Handler for |list| callbacks.
% \changes{v1.0k}{2015/12/02}{resolve name and i.description (PHG)}
% \changes{v1.1s}{2020/12/02}{Fix return value of list callbacks}
+% \changes{v1.1w}{2021/11/17}{Never pass on \texttt{true} return values for list callbacks}
% \begin{macrocode}
local function list_handler(name)
return function(head, ...)
local ret
- local alltrue = true
for _,i in ipairs(callbacklist[name]) do
ret = i.func(head, ...)
if ret == false then
@@ -1533,18 +1533,17 @@ local function list_handler(name)
return false
end
if ret ~= true then
- alltrue = false
head = ret
end
end
- return alltrue and true or head
+ return head
end
end
% \end{macrocode}
% Default for user-defined |list| and |reverselist| callbacks without explicit default.
% \begin{macrocode}
-local function list_handler_default()
- return true
+local function list_handler_default(head)
+return head
end
% \end{macrocode}
% Handler for |reverselist| callbacks.
@@ -1553,7 +1552,6 @@ end
local function reverselist_handler(name)
return function(head, ...)
local ret
- local alltrue = true
local callbacks = callbacklist[name]
for i = #callbacks, 1, -1 do
local cb = callbacks[i]
@@ -1566,11 +1564,10 @@ local function reverselist_handler(name)
return false
end
if ret ~= true then
- alltrue = false
head = ret
end
end
- return alltrue and true or head
+ return head
end
end
% \end{macrocode}
@@ -1901,14 +1898,10 @@ callback_register("mlist_to_hlist", function(head, display_type, need_penalties)
if current == false then
flush_list(head)
return nil
- elseif current == true then
- current = head
end
current = call_callback("mlist_to_hlist", current, display_type, need_penalties)
local post = call_callback("post_mlist_to_hlist_filter", current, display_type, need_penalties)
- if post == true then
- return current
- elseif post == false then
+ if post == false then
flush_list(current)
return nil
end
diff --git a/base/ltshipout.dtx b/base/ltshipout.dtx
index 7f6555d18..9e7bf4be8 100644
--- a/base/ltshipout.dtx
+++ b/base/ltshipout.dtx
@@ -741,8 +741,9 @@
luatexbase.create_callback('pre_shipout_filter', 'list')
local~call, getbox, setbox = luatexbase.call_callback, tex.getbox, tex.setbox~
lua.get_functions_table()[\the \@@_finalize_box:] = function()
- local~result = call('pre_shipout_filter', getbox(\the \l_shipout_box))
- if~not (result == true) then~
+ local head = getbox(\the \l_shipout_box)
+ local~result = call('pre_shipout_filter', head)
+ if~not (result == head) then~
setbox(\the \l_shipout_box, result~or~nil)
end~
end
diff --git a/base/testfiles/tlb-ltluatex-001.luatex.tlg b/base/testfiles/tlb-ltluatex-001.luatex.tlg
index 7f07f32d4..53c7483d1 100644
--- a/base/testfiles/tlb-ltluatex-001.luatex.tlg
+++ b/base/testfiles/tlb-ltluatex-001.luatex.tlg
@@ -7,7 +7,7 @@ stack traceback:
^^I[C]: in function 'error'
^^I./ltluatex.lua:110: in upvalue 'module_error'
^^I./ltluatex.lua:117: in upvalue 'luatexbase_error'
-^^I./ltluatex.lua:432: in field 'create_callback'
+^^I./ltluatex.lua:428: in field 'create_callback'
^^I[\directlua]:1: in main chunk.
l. ...}
The lua interpreter ran into a problem, so the
From 43e79ce626ba397a0c1af49c7f88b08ab4769e98 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcel=20Fabian=20Kr=C3=BCger?=
Date: Wed, 17 Nov 2021 09:17:57 +0100
Subject: [PATCH 3/3] Install hypdoc for GH Actions
---
.github/tl_packages | 1 +
1 file changed, 1 insertion(+)
diff --git a/.github/tl_packages b/.github/tl_packages
index 545df83ef..7ad52cafd 100644
--- a/.github/tl_packages
+++ b/.github/tl_packages
@@ -22,6 +22,7 @@ hyperref
oberdiek
lh
tex-gyre
+hypdoc
#
# special testing for firstaid
bidi