[NTG-context] Preparing a weird index.

Hans Hagen pragma at wxs.nl
Fri Jun 27 09:32:28 CEST 2014


On 6/27/2014 7:42 AM, Gour wrote:
> Hans Hagen <pragma at wxs.nl> writes:
>
>> i don't know xindy but normally the context mkiv index mechanism is
>> flexible enough (and it can be configured)
>
> Here are some snippets from my old xindy setup...
>
> ;; define order of sorting runs
> (use-rule-set :run 0
>                :rule-set ("resolve-sanskrit-diacritics" "hr-alphabetize"
>                "hr-ignore-special"))
> (use-rule-set :run 1
>                :rule-set ("hr-resolve-diacritics" "hr-ignore-special"))
> (use-rule-set :run 2
>                :rule-set ("hr-resolve-case" "hr-ignore-special"))
> (use-rule-set :run 3
>                :rule-set ("hr-resolve-special"))
>
> which says that the sorting should be done in the following order: first
> rules for sanskrit diacriticits, then alphabetic sort of Croatian (hr)
> characters etc. followed by another set of rules saying to sort Croatian
> diacritics (I was using latin2 encoding) etc.
>
> Here is example of resolve-sanskrit-diacritics:
>
> (define-rule-set "resolve-sanskrit-diacritics"
>
>     :rules  (("\\={(a)}" "\1" :bregexp :again)
>              ("\\={\\i}" "i" :bregexp :again)
>              ("\\={I}" "I" :bregexp :again)
>              ("\\\.{(.)}" "\1" :bregexp :again)
>              ("\\d{(r)}" "ri" :bregexp :again)
>              ("\\d{(t)}" "\1" :bregexp :again)
>              ("\\d{(T)}" "\1" :bregexp :again)
>              ("\\d{(d)}" "\1" :bregexp :again)
>              ("\\d{(n)}" "\1" :bregexp :again)
>              ("\\d{(s)}" "š" :bregexp :again)
>              ("\\d{(S)}" "Š" :bregexp :again)
>              ("\\~{(.)}" "\1" :bregexp :again)
>              ("\\'{(c)}" "ć" :bregexp :again)
>              ("\\'{(C)}" "Ć." :bregexp :again)
>              ("\\'{(s)}" "š" :bregexp :again)
>              ("\\'{(S)}" "Š" :bregexp :again)
>              ))
>
> which says that e.g. 'ṣ' which is pronounced similar to Croatian 'š'
> should go in the same letter-group, same with 'Ś' which goes to 'Š'. 'ṛ'
> is pronounced as 'ri' and it should goes in the letter group 'ri' etc.
>
> Of course, at that time, without proper Unicode support, it was a bit
> cumbersome but I was able to see everything properly in LyX as well as
> properly sorted in the final PDF/PS outputs.
>
> Is something like that possible in ConTeXt?

See sort-lan.lua ... you could define a pseudo-language for this and use 
that one for sorting. The actual sorting is driven by a sequence of 
steps that (can) involve uppercase, lowercase, shape, unicode, specific 
order etc.

Hans

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


More information about the ntg-context mailing list