ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
To: ntg-context@ntg.nl
Subject: Re: How to hack the lua files
Date: Fri, 07 Jun 2013 15:48:37 +0200	[thread overview]
Message-ID: <51B1E4B5.1070403@wxs.nl> (raw)
In-Reply-To: <51b1dc7a.caef440a.3a4a.ffffea86@mx.google.com>

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
-----------------------------------------------------------------
___________________________________________________________________________________
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	other threads:[~2013-06-07 13:48 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.1195.1370589979.2084.ntg-context@ntg.nl>
2013-06-07 13:00 ` Lance Larsen
2013-06-07 13:03   ` luigi scarso
2013-06-07 15:27     ` Sietse Brouwer
2013-06-07 15:36       ` Hans Hagen
2013-06-07 15:36       ` Wolfgang Schuster
2013-06-07 15:42       ` luigi scarso
2013-06-07 15:49         ` Sietse Brouwer
2013-06-07 16:21           ` luigi scarso
2013-06-07 13:17   ` luigi scarso
2013-06-07 13:48     ` Wolfgang Schuster
2013-06-07 13:13 ` Lance Larsen
2013-06-07 13:48   ` Hans Hagen [this message]
     [not found] <mailman.1201.1370610850.2084.ntg-context@ntg.nl>
2013-06-07 14:01 ` Lance Larsen
2013-06-07 14:10   ` Hans Hagen
2013-06-06 23:20 Lance Larsen
2013-06-07  7:25 ` Hans Hagen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51B1E4B5.1070403@wxs.nl \
    --to=pragma@wxs.nl \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).