ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Martin Fechner <fechner@bbaw.de>
To: Hans Hagen <pragma@wxs.nl>
Cc: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: lua and brackets
Date: Thu, 03 Nov 2011 15:10:15 +0100	[thread overview]
Message-ID: <4EB2A0C7.4000101@bbaw.de> (raw)
In-Reply-To: <4EB29467.3050407@wxs.nl>


> And if you want pure lua, you can do:
>
> \startluacode
> function document.pagesetup(ref_one,ref_two)
> local one, bug = structures.references.identify("",ref_one)
> if bug then
> context("[unknown reference: %s]",ref_one)
> return
> end
> local two, bug = structures.references.identify("",ref_two)
> if bug then
> context("[unknown reference: %s]",ref_two)
> return
> end
> structures.references.analyze(one)
> structures.references.analyze(two)
> local r_one = one.realpage
> local r_two = two.realpage
> if not r_one or not r_two then
> context("[unknown pagenumbers]")
> elseif r_one == r_two then
> context("[same pagenumbers]")
> else
> context("[different pagenumbers]")
> end
> end
> \stopluacode
>
> \ctxlua{document.pagesetup("one","two")}
> \ctxlua{document.pagesetup("one","two-a")}
> \ctxlua{document.pagesetup("two-a","two-b")}
>
> but the reference interface is not yet documented
>

Thanks, the lua solution works fine. One question: is the same possible 
with linereferences as with pagereferences? It's very important for the 
critical edition project I'm working at.

Greetings, Martin
___________________________________________________________________________________
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:[~2011-11-03 14:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-03  9:15 Martin Fechner
2011-11-03 11:01 ` Hans Hagen
2011-11-03 11:42   ` Martin Fechner
2011-11-03 13:17     ` Hans Hagen
2011-11-03 14:10       ` Martin Fechner [this message]

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=4EB2A0C7.4000101@bbaw.de \
    --to=fechner@bbaw.de \
    --cc=ntg-context@ntg.nl \
    --cc=pragma@wxs.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).