From: Hans Hagen <pragma@wxs.nl>
To: ntg-context@ntg.nl
Subject: Re: index(register) from an XML source
Date: Sat, 14 Jan 2017 20:40:57 +0100 [thread overview]
Message-ID: <7579d05e-d57b-92a2-31b8-3f090465edc1@wxs.nl> (raw)
In-Reply-To: <1484405545.14165.1.camel@fastwebnet.it>
On 1/14/2017 3:52 PM, MF wrote:
> Thank you, Hans.
> I had found a solution, then I saw your e-mail.
> Anyway I've learned a lot from it.
> My solution was something like this:
>
> function xml.functions.indexEntry(e)
> local animal = animals[e.at.idref]
> if animal then
> --[[
> context.Animal (
> { animal.key },
> "\\xmlflush{main::" .. animal.entry.ix .. "}"
> )
> --]]
> context.Animal( { animal.key } )
> context.bgroup()
> lxml.flush(animal.entry)
> context.egroup()
> end
> end
>
> The PDF output is right. Is it really the same?
no, but the effect can be the same (just compare the tuc files)
> Now an alternative approach I thought, because the index I'm working on
> is a biographical index, I mean a index of cited people, with a
> biographical profile. So every entry is a few lines long.
> That's why I thought to index only the ids in the text and use a
> textcommand in the index to pass from the id to the real entry.
>
> Suppose to use \setupregister[Animal][textcommand=\fromIdToEntry] and
> an indexEntry function modified like this:
>
> function xml.functions.indexEntry(e)
> local animal = animals[e.at.idref]
> if animal then
> context.Animal( { animal.key }, e.at.idref )
> end
> end
>
> Without a textcommand, you would have an index of the ids.
> The textcommand \fromIdToEntry should take the id of an index entry and
> typeset the entry content.
>
> \def\fromIdToEntry#1{ ... }
>
> #1 is the id, but it's not a string.
> Is there a way to use it as a string to look for the entry?
> Is this approach better?
comparable
btw, you can better use deeptextcommand as textcommand gets something
more passed
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
next prev parent reply other threads:[~2017-01-14 19:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-13 17:10 MF
2017-01-14 12:53 ` Hans Hagen
2017-01-14 14:52 ` MF
2017-01-14 16:34 ` Alan Braslau
2017-01-14 19:40 ` Hans Hagen [this message]
2017-01-14 23:07 ` MF
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=7579d05e-d57b-92a2-31b8-3f090465edc1@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).