On 2-10-2012 02:30, Andre Caldas wrote:
I am trying to redefine the ’open_read_file’ callback.

[...]
direct callback access is disabled. There are usually some layers
of abstraction on top of them, different ones for different
callbacks. Mapping them all is a huge effort, so best refer to
the source.

In your case the function resolvers.openers.helpers.textopener()
takes the place of the open_read_file callback. It can be found
in data-tex.lua.

Shall I simply do something like this?

local function textopener(tag, filename, filehandle, coding)
   result = old_textopener(tag, filename, filehandle, coding)
   -- Do lots of things
   return result
end

resolvers.openers.helpers.textopener = textopener

this is not the recommended way .. better do somethign like this:

\starttext

\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

\input ward

\input knuth

\stoptext


-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
    tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to