summaryrefslogtreecommitdiff
path: root/luatexbase-mcb.dtx
diff options
context:
space:
mode:
authorManuel Pégourié-Gonnard <mpg@elzevir.fr>2010-11-05 18:56:02 +0100
committerManuel Pégourié-Gonnard <mpg@elzevir.fr>2010-11-11 15:52:24 +0100
commitca07dd609c306a6448ec301168a87df28aa250f0 (patch)
treeeef9cfc87e5f54e477fc3daa1e78561d41a986c0 /luatexbase-mcb.dtx
parent3f9de09eb2fdc29b8fca10f7a9bf29aff883965f (diff)
downloadluatexbase-ca07dd609c306a6448ec301168a87df28aa250f0.tar.gz
Fix listhandler again.
Diffstat (limited to 'luatexbase-mcb.dtx')
-rw-r--r--luatexbase-mcb.dtx23
1 files changed, 13 insertions, 10 deletions
diff --git a/luatexbase-mcb.dtx b/luatexbase-mcb.dtx
index 39551eb..9af132f 100644
--- a/luatexbase-mcb.dtx
+++ b/luatexbase-mcb.dtx
@@ -165,15 +165,16 @@ See source file '\inFileName' for details.
% (possibly modified): the functions are called in order, and each is
% 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 for functions taking the head of a node list as their first
-% argument (and possibly other arguments) and returning either a modified
-% node list or |true| or |false|. If a function returns a node
-% list, then this node list is passed as the first argument to the next
-% function, along with the original remaining arguments; if it returns
-% |true|, the original node list is passed to the next function; if it
-% returns false, then no the other functions are \emph{not} called, a
-% warning is issued and |false| is immediately returned. Otherwise, the
-% return value of the last function is returned.
+% \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 return and the
+% following functions are \emph{not} called. If one 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
+% value of the last function not returning |true| is used.
% \item[first] is for functions with more complex signatures; functions in
% this type of callback are \emph{not} combined: only the first one
% (according to priorities) is executed.
@@ -512,6 +513,7 @@ end
local function listhandler (name)
return function(head,...)
local ret
+ local alltrue = true
for _, f in ipairs(callbacklist[name]) do
ret = f.func(head, ...)
if ret == false then
@@ -520,10 +522,11 @@ local function listhandler (name)
break
end
if ret ~= true then
+ alltrue = false
head = ret
end
end
- return ret
+ return alltrue and true or head
end
end
% \end{macrocode}