Changes

Jump to navigation Jump to search
1,984 bytes added ,  10:27, 2 October 2012
collect callback stuff here, please expand!
The '''callback''' system from LuaTeX has been disabled.
Instead, Context defines ''actions'' that must be registered through an
offical mechanism.
Then they can be toggled on and off at will, as long as it makes sense.

== Actions ==

This page is dedicated to collecting all available information on how
to achieve in Context when you would resort to callbacks to do the same
in plain LuaTeX.

=== File reading callbacks / <code>open_read_file</code> ===
The functionality provided by the <code>open_read_file</code> callback
can be accessed through a string filter that is hooked into the
<code>textfileactions</code> processor ({{src|data-tex.lua}}, cf. {{src|luat-fio.lua}})

Hans demonstrated the canonical way on the mailing list
[http://archive.contextgarden.net/message/20121002.080504.10fba6de.en.html]:

<texcode>
\startluacode

function document.MyCharacterMess(str,filename)
if file.nameonly(filename) == "ward" then
str = table.concat(string.totable(str,"."), " + ")
end
return str
end

local textfileactions = resolvers.openers.helpers.textfileactions
utilities.sequencers.appendaction(textfileactions,"system","document.MyCharacterMess")

\stopluacode

\starttext
\input ward
\input knuth
\stoptext
</texcode>


== Further Information ==

* An [http://tex.stackexchange.com/questions/11960/how-to-register-a-callback-in-context informative Thread], initiated by Patrick
* Some related user reports [http://archive.contextgarden.net/message/20100219.070449.3ef91a45.en.html on] [http://archive.contextgarden.net/message/20100408.182612.5fa89eef.en.html the] [http://archive.contextgarden.net/message/20101017.140616.e9262376.en.html mailing] [http://archive.contextgarden.net/message/20120625.133813.e3875200.en.html list]
* [[Miscellaneous Lua Topics]]
/code> ===
The functionality provided by the

[[Category:Lua]]
[[Category:LuaTeX]]
[[Category:Callbacks]]
/code> callback
can be accessed through a string filter that is hooked into the
188

edits

Navigation menu