From 22fcad0d55491a419c3bdaf6e51d97394894c05c Mon Sep 17 00:00:00 2001 From: Udi Fogiel Date: Sat, 11 Jan 2025 21:44:21 +0200 Subject: [PATCH] correct doc about list handler (ltluatex) The documentation states that of all the functions in the callback returns true then the callback returns true as well, but the following example (and the code) shows that the return value in this case is the head passed to the callback. \directlua{ luatexbase.create_callback('foo', 'list', false) luatexbase.add_to_callback('foo', function(head) print('bar') return true end, 'baz') print(luatexbase.call_callback('foo', token.scan_list())) }\hbox{foo} \stop --- base/changes.txt | 6 ++++++ base/ltluatex.dtx | 17 +++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/base/changes.txt b/base/changes.txt index d55227606..75df8857e 100644 --- a/base/changes.txt +++ b/base/changes.txt @@ -6,6 +6,12 @@ to completeness or accuracy and it contains some references to files that are not part of the distribution. ================================================================================ +2025-01-10 Udi Fogiel + + * ltluatex.dtx (subsubsection{Handlers}): + Correct documentation about the return value + of the list handler + 2025-01-10 Frank Mittelbach * ltmarks.dtx (subsection{Updating mark structures}): diff --git a/base/ltluatex.dtx b/base/ltluatex.dtx index a85e6c3e8..594fcce23 100644 --- a/base/ltluatex.dtx +++ b/base/ltluatex.dtx @@ -30,7 +30,7 @@ %<*plain> % \fi % \ProvidesFile{ltluatex.dtx} -[2024/08/16 v1.2e +[2025/01/11 v1.2e % LaTeX Kernel (LuaTeX support)^^A %\iffalse % LuaTeX support for plain TeX (core)% @@ -1676,14 +1676,15 @@ end % passed the return value of the previous (and the other arguments % untouched, if any). The return value is that of the last function; % \item[list] is a specialized variant of \emph{data} for functions -% filtering node lists. Such functions may return either the head of a -% modified node list, or the boolean values |true| or |false|. The -% functions are chained the same way as for \emph{data} except that for -% the following. If -% one function returns |false|, then |false| is immediately returned and -% the following functions are \emph{not} called. If one function returns +% filtering node lists. Such functions are called with a node list head +% as the first argument and may return either the head of a modified node list, +% or the boolean values |true| or |false|. +% The functions are chained the same way as for \emph{data} except for +% the following cases. +% If a function returns |false|, then |false| is immediately returned and +% the following functions are \emph{not} called. If a function returns % |true|, then the same head is passed to the next function. If all -% functions return |true|, then |true| is returned, otherwise the return +% functions return |true|, then the original head is returned, otherwise the return % value of the last function not returning |true| is used. % \item[reverselist] is a specialized variant of \emph{list} which executes % functions in inverse order.