[Trennmuster] Callbacks
Herbert Voss
Herbert.Voss at fu-berlin.de
Fr Okt 16 19:53:29 CEST 2020
Am 16.10.20 um 19:38 schrieb Stephan Hennig:
> Am 15.10.20 um 20:35 schrieb Keno Wehr:
>> Am 15.10.20 um 00:58 schrieb Stephan Hennig:
>>> Am 12.10.20 um 22:10 schrieb Keno Wehr:
>>>> Am 01.10.20 um 02:38 schrieb Stephan Hennig:
>>>>> Ich dachte, luatexbase bzw. ltluatex würde die Callbacks exklusiv
>>>>> reservieren (solange niemand dazuwischenfunkt) und dann verschiedenen
>>>>> Interessenten geordneten Zugriff darauf gestattet. Ist das nicht so?
>>>>> Ich habe das nicht mehr parat.
>>>> Im Prinzip ja, aber bei exklusiven Callbacks wie „hyphenate“ und
>>>> „ligaturing“ kann nur eine Funktion angewandt werden.
>>> Das würde den Zweck der Callback-Behandlung in ltluatex aber ad absurdum
>>> führen. Ein Vorteil gegenüber LuaTeX wäre dann ja nicht erkennbar.
>> Ja, du hast Recht. Ich habe jetzt den passenden Abschnitt in der
>> ltluatex-Anleitung gefunden:
>> 5.18 Lua callback management
>>
>> Dort wird allen Callbacks einer der Typen „list“, „data“, „exclusive“,
>> „simple“, „reverselist“ zugeordnet. Was diese Typen genau bedeuten, wird
>> leider nicht erklärt, auch in der LuaTeX-Anleitung nicht.
steht doch da:
simple: is for functions that don’t return anything: they are called in
order, all with the same argument;
data: is for functions receiving a piece of data of any type except node
list head (and possibly other arguments) and returning it (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;
list: is a specialized variant of 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 data except that for the following. If one function
returns false, then false is immediately returned and the following
functions are 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.
reverselist: is a specialized variant of list which executes functions
in inverse order.
exclusive: is for functions with more complex signatures; functions in
this type of callback are not combined: An error is raised if a second
callback is registered..
Herbert
Mehr Informationen über die Mailingliste Trennmuster