[sword-devel] Determining the absolute verse number/index of a verse within a book
Tobias Klein
contact at tklein.info
Sun Mar 1 07:49:18 MST 2020
Hi,
I've been trying to determine the absolute verse number/index of a verse
within a book.
SWModule::getIndex() and VerseKey::getIndex() each return the index
within the whole module, but I need the index of a verse within the same
book.
I tried to calculate this absolute verse index/number by getting a
second verse key that points to the first verse of the same book and
then taking the difference between this second key and the key of the
verse I'm looking at. That "kind of" worked. However, the book/chapter
introductions seem to be counted as well and I did not find a way to
avoid that.
Any pointers? :)
Best regards,
Tobias
PS:
I'm doing this while porting Ezra Project to use Sword directly (instead
of reading text from my database).
In Ezra Project I am "addressing" verses using the book + absolute verse
number. This way I'm storing "verse reference" objects and then tags get
associated with those verse reference objects.
Getting the absolute verse number is easy when fetching a whole book (I
simply generate it myself in this case). But when I for example get
search results via Sword, then I get individual verses and can't easily
generate the absolute verse number. Even in that case I still need to
match search result verses with existing tags and that's where I run
into the above mentioned issue.
More information about the sword-devel
mailing list