4

Is there a way extend xindy in a way that it passes some meta information through the sorting algorithm and then to process those information in the output markup?

Specificly, i need my index terms to not only show the page number but also an section id and the volume of the book it occcurs in. Is there a way to pass those information from the raw index to the output markup within xindy?

An minimal example raw index would look like that:

(indexentry :tkey (("α-Tier")) :locref "2" :id "xyz_sec-13.01" :edn "1.1")
(indexentry :tkey (("Tier α")) :locref "6" :id "xyz_subsec-1302" :edn "10.9")

Of course, this isn't acceptable to xindy ("Syntax error") since there are no id and edn attributes for indexentry. I also tried something like

(indexentry :tkey (("α-Tier")) :locref "2" :attr "id=xyz_sec-13.01,edn=1.1")
(indexentry :tkey (("Tier α")) :locref "6" :attr "id=xyz_subsec-1302,edn=10.9")

but that doesn't work either.

I got it to work by using

(indexentry :tkey (("α-Tier@@id=xyz_sec-13.01,edn=1.1@@")) :locref "2")
(indexentry :tkey (("Tier α@@id=xyz_sec-1302,edn=10.9@@")) :locref "6")

clipping @@[^@]+@@ via a merge rule and adjust my output markup with a preprocessor. But i wonder if there is a more elegant way to do this, ideally from within xindy?

  • You can do this with location classes. How do you want this printed? – A Gold Man Dec 18 '17 at 12:42
  • @AGoldMan Not at all… I get xml in the end. – Lupino Dec 18 '17 at 13:44
  • I'll post an answer using location classes, and you'll let me know if it needs to be changed. – A Gold Man Dec 18 '17 at 13:45
0

If you add the following line to your .xdy file,

(define-location-class "SecAndEdn" :var ("arabic-numbers" 
   :sep ";sec-" "arabic-numbers" :sep ";" "arabic-numbers"))

it will allow you to pass in a location formatted like this:

(indexentry :tkey (("α-Tier")) :locref "2;sec-13;2017")
(indexentry :tkey (("Tier α")) :locref "6;sec-14;2017")

To break that down, what we did was create a new location class, that takes locations using the "arabic-numbers" alphabet. We use the :var option to allow it to take in additional information, here being that we open another level to allow the section, which is "arabic-numbers" preceded by ";sec-", and then another "arabic-numbers" preceded by just ";".

If you'd like a different seperator, you can change the argument for :sep to whatever you'd like to use.

  • It's a start. Unfortunately, it is not only "sec" but also "chap" or "part" or "subsec" including "pointed" numbers like "subsubsec-3.02.22" i need to transfer… And it must not interfer with the ordering of the actual, real page numbers. Also, edition is a bit more complicated than in my minimal example: Editions are something like "7.1" or "10.8"… – Lupino Dec 18 '17 at 13:59
  • Thanks for clarifying that. I'll try to get something that hits your exact needs. – A Gold Man Dec 18 '17 at 14:29
  • @Lupino Do the section and edition numbers vary in amount of points they have? Meaning do you have "7" as an edition and also "7.4"? – A Gold Man Dec 19 '17 at 15:14
  • Edition is straight forward, i.e. always "x.y". But the "section" is not. It is string_string-[number|letter]+(point number+)* and anything in between. And this pattern is not "negotiable". EDIT: i'll adjust my examples in the question… – Lupino Dec 20 '17 at 8:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.