[sword-devel] Pre-verse div and headings

DM Smith dmsmith at crosswire.org
Mon Jan 21 09:37:40 MST 2013

On Jan 21, 2013, at 9:23 AM, "Peter von Kaehne" <refdoc at gmx.net> wrote:

>> Von: DM Smith <dmsmith at crosswire.org>
>> In the past, I've viewed the "headings" toggle as a toggle for
>> non-canonical material. But the discussion on the other thread has me wondering
>> whether intros (non-canonical) information is handled by it.
> That is exactly what I said - the headline toggle switches on everything, intros and the like. 
> Now Troy says this is not how it should be and how the engine is handling it, but fact is that it does so. On all modules I have tried out where I know there is intro material.
> Now, my question - is there something very simple we module makers do wrong? Or is there some major and overarching misunderstanding between engine design, osis2mod and module makers?

Here is what osis2mod expects regarding intros and headings.

Intro to the work as a whole: not expected, and not handled.
Intro to a testament: not expected, not handled.
These intros are not ignored, but accumulated for the first write done by osis2mod. Hopefully it will be a book intro, but the behavior is not defined.

Intro to a book. This is everything between <div type="book"> and <chapter> (or <div type="chapter">, the other chapter start).

Intro to a chapter. This is a bit more difficult. The problem is that it occupies the space between a chapter start and verse 1. These may be a chapter title, or verse title, or both. Osis2mod uses markup help to distinguish these. Here are the rules:
o If the <title> is within <div type="section"> it is understood as a verse title.
o If the <title> has a type other than main, chapter or sub, it is understood as a verse title.
Note, the first of these conditions determines a boundary between chapter and verse. If after one of these there is a title that has a type of main, chapter or sub. It is understood as belonging to the verse, not the chapter.

That is how the title element is decided.

> FWIW, usfm2osis.pl (and presumably usfm2osis.py) do not produce a verse or chapter 0 div but produce div type intro or something similar.

Note, when the chapter start is seen an inChapterIntro is set. And when one of the above is met, then inChapterIntro is cleared and inPreVerse is set.

So, the div type of intro is not directly taken into account.

There is another part to preVerse determination:  whether interVerse material falls with verse n (where n >= 1) or verse n+1. (This does not apply to the division between chapter start and first verse).

Basically, after the </verse> (or equivalent) is found it looks for start, end and empty tags. As long as end and empty tags are found, it is seen as belonging to the prior verse. Otherwise it is seen as the next verse. This applies to the division between chapter and first verse and to one verse and the next. But it does not apply to stuff after the last verse of the chapter (such as colophons). That is appended to the last verse.

Hope this helps.

In Him,

More information about the sword-devel mailing list