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 -----------------------------------------------------------------