Skip to content

Commit

Permalink
Merge branch 'develop' into doc-cleanup
Browse files Browse the repository at this point in the history
# Conflicts:
#	base/changes.txt
  • Loading branch information
FrankMittelbach committed Nov 17, 2021
2 parents a76f7b7 + 43e79ce commit 7ee49dd
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 19 deletions.
1 change: 1 addition & 0 deletions .github/tl_packages
Expand Up @@ -22,6 +22,7 @@ hyperref
oberdiek
lh
tex-gyre
hypdoc
#
# special testing for firstaid
bidi
Expand Down
6 changes: 6 additions & 0 deletions base/changes.txt
Expand Up @@ -6,6 +6,12 @@ completeness or accuracy and it contains some references to files that
are not part of the distribution.
================================================================================

2021-11-17 Marcel Krüger <Marcel.Krueger@latex-project.org>

* ltluatex.dtx:
Classify [hv]pack_quality callbacks as exclusive
Never pass true to the engine for LuaTeX list callbacks

2021-11-15 Frank Mittelbach <Frank.Mittelbach@latex-project.org>

* build.lua (textfiles):
Expand Down
13 changes: 13 additions & 0 deletions base/doc/ltnews35.tex
Expand Up @@ -147,6 +147,19 @@ \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.

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{???}
Expand Down
27 changes: 11 additions & 16 deletions base/ltluatex.dtx
Expand Up @@ -28,7 +28,7 @@
\ProvidesFile{ltluatex.dtx}
%</driver>
%<*tex>
[2021/10/15 v1.1v
[2021/11/17 v1.1w
%</tex>
%<plain> LuaTeX support for plain TeX (core)
%<*tex>
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -1516,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
Expand All @@ -1531,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.
Expand All @@ -1551,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]
Expand All @@ -1564,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}
Expand Down Expand Up @@ -1899,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
Expand Down
5 changes: 3 additions & 2 deletions base/ltshipout.dtx
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion base/testfiles/tlb-ltluatex-001.luatex.tlg
Expand Up @@ -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
Expand Down

0 comments on commit 7ee49dd

Please sign in to comment.