Re: [NTG-context] How to hack the lua files
Hans,
Your reply below was very helpful. I looked at the context command line
options and saw 'make'. After running this, the code changes took effect.
Thankyou.
I could still use help in identifying where equation numbers are defined in
the code so that I can add a tracker. Do you have a suggestion of which
function (or at least lua file) I should look in for this?
I am also curious how hooks are defined, so that I can identify them in the
code and see if there is one that would meek my purpose - also where the
hook scripts are placed so that context can find them.
Thanks again for the reply which got me over the first hurdle.
-Lance
------------------------------
Message: 4
Date: Fri, 07 Jun 2013 09:25:36 +0200
From: Hans Hagen
I have a version of context standalone installed, and I am trying to add some functionality I need to strc-ref.lua. As a simple test to see if modifying the file was working, I enabled the ?structures.referencing.identifying? tracker and verified that I was getting messages from this tracker in the log. I then modified the log statement in strc-ref.lua and processed the document again. The changes I made to the lua file did not seem to be active. I verified that there is only one log statement that matches the output I am seeing. Why would my lua code change not be active? Is the lua code cached somehow? (I am running this from windows if that matters).
The code I modified is under the path:
context\tex\texmf-context\tex\context\base\ strc-ref.lua
if you patch files that way you need to remake the format file I don't know what you patch, but changing something in a core file is no guarantee for the future. It's not a problem to add functionality (lots of hooks for that) but best do that in a local module that gets loaded at runtime then. Hans ----------------------------------------------------------------- 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 -----------------------------------------------------------------
On 6/7/2013 3:13 PM, Lance Larsen wrote:
Hans,
Your reply below was very helpful. I looked at the context command line options and saw 'make'. After running this, the code changes took effect. Thankyou.
I could still use help in identifying where equation numbers are defined in the code so that I can add a tracker. Do you have a suggestion of which function (or at least lua file) I should look in for this?
I am also curious how hooks are defined, so that I can identify them in the code and see if there is one that would meek my purpose - also where the hook scripts are placed so that context can find them.
Thanks again for the reply which got me over the first hurdle.
It's not that trivial as numbers are not stored like 2.1.2 and so, but as abstractions with optional rendering directives so that they can be generated on demand, depending on circumstances. For instance a formula number can be formatted differently in a list, reference, formula or wherever needed. So, in principle, there can be \in{formula}[a] references rendered in one place as 1.2.1 with the 1 being green and slanted and another place as 2.1 with the 1 being red and bold. So .. if a tracing feature like yours is needed for some reason, it has to be hooked into several places but in a consistent way (quite doable but takes time and no one needed it). The reason is that there is not one list of references but for efficiency reasons references are picked up from several 'tables'. For instance, currently, formula references come from structure lists (which also indicates that there can be lists of formulas). The following demonstrates this. \setupbodyfont[pagella] \starttext \placeformula[a] \startformula a \stopformula see \in{formula}[a] \placeformula[b] \startformula b \stopformula see \in{formula}[b] \startformula c \stopformula \startluacode local list = structures.lists.collected for i, l in ipairs(list) do -- if l.metadata.name == "formula" then logs.report("references",string.formatters["%s: %.t"]( l.references.reference, l.numberdata.numbers )) -- end end \stopluacode \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 -----------------------------------------------------------------
participants (2)
-
Hans Hagen
-
Lance Larsen