Hello all,

I’m just getting acquainted with ConTeXt, and I am finding it so much more 
suitable for my work and needs. Thanks for the great software. Here’s my 
situation. I write in Slovene and in English, and I need to make numerous 
references to biblical passages. I want to create an index of these citations, 
but I want them in the order they appear in the Bible rather than alphabetical 
order. Henri Menke provided a perfectly workable solution on TeX 
StackExchange[^1], but because this is a multi-year project, I wanted to find a 
bit more permanent solution. I discovered I can use Lua LPEG to parse and 
normalize my citations so they are referenced in a uniform style.

My problem comes in the register sorting. Hans, I saw where in the paste you 
have recommended a “pseudo-language” to implement a custom sort in such a 
situation. I have almost figured out how to accomplish this. (See the MWE 
below.) I have no problem with single word sections (Genesis, Exodus, etc.). I 
can turn off indicators, do the custom sort (see below), and I get the intended 
result. If I have a multiple word title (Evangelij po Janezu), that technique 
doesn’t work. The replacement for more than one word (or if a number is 
involved, like 1John) doesn’t seem to work. I have no doubt there is a good 
reason; I’m just a newbie!

It seems my options are to:

1. Figure out how to do a replacement for a phrase or a book with a number in 
its name. Then this technique seems to work ok.
2. Or to add an entries and figure out some way to not print the first level in 
the index. So the indicator will be the book name, and underneath the chapter 
and verses will be listed with out the book name being repeated.


Are there any ideas to point me in the right direction?

Thanks so much for your help,
John Grasty



[1]: 
https://tex.stackexchange.com/questions/418575/custom-ordering-for-a-index-register-in-context/

- - - -

\startluacode

local utfchar, utfbyte  = utf.char, utf.byte
local sorters           = sorters
local definitions       = sorters.definitions
local replacementoffset = sorters.constants.replacementoffset
local variables         = interfaces.variables

local gen  = utfchar(replacementoffset + 1), utfchar(replacementoffset + 11)
local exo = utfchar(replacementoffset + 2), utfchar(replacementoffset + 220)
local jn = utfchar(replacementoffset + 4), utfchar(replacementoffset + 27)


sorters.definitions['bbt'] = {
    replacements = {
        { "Geneza", gen },
        { "Eksodus", exo }, 
        { "Janez", jn },
        },

    orders = {
        gen, exo, jn
    }
}
\stopluacode

\mainlanguage[sl]

\defineregister[booksort]
\setupregister[booksort]
 [language=bbt,
  n=1,
  indicator=yes,
  ]
  

\starttext

\booksort{Janez+5.2}One
\booksort{Eksodus+2}Two
\booksort{Geneza+45}Three

\page

\placeregister[booksort][language=bbt]

\stoptext
 











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

Reply via email to