[sword-devel] Headings, Titles and Intros

DM Smith dmsmith at crosswire.org
Fri Dec 18 06:33:01 MST 2009


Regarding OSIS markup and osis2mod. For the most part osis2mod has to guess as to where to put non-verse material. Basically, everything in the OSIS file except the OSIS preamble (it's called a header but that's confusing for this discussion) will be put somewhere in the module.

I'm not sure that osis2mod handles module or testament introductions properly. ATM, I think these are made to be introductions of Genesis and Matt. If you have either of these, let me know, so I can test for that.

For details see:
	http://crosswire.org/wiki/OSIS_Bibles
and
	http://crosswire.org/wiki/Osis2mod#Handling_of_Introductions.2C_Titles_and_Inter-Verse_Material

If the documentation there is weak feel free to comment on it on the talk page. If something is missing, then add a heading for it and we'll try to fill in the details.

In His Service,
	DM

On Dec 18, 2009, at 5:10 AM, Manfred Bergmann wrote:

> Hello Troy.
> 
> Ok, let me summarise:
> 
> Headings (as the name of the VerseKey function) are used for module, testament, book and chapter intros.
>> From looking into osis2mod.cpp they have to be encoded in OSIS like:
> // Everything between the begin book tag and the first begin chapter tag is inBookIntro
> // Everything between the begin chapter tag and the first begin verse tag is inChapterIntro
> Books are encoded with:
> <div canonical="true" type="book" osisID="Gen">
> So everything between this tag and the first <chapter /> tag is a book intro and retrievable using:
> testament.book.0
> 
> Can the intro be embedded in another node which is not a text node?
> Chris mentioned something like:
> <div type="introduction" />
> 
> 
> The global option "Headings" is used for pre-verse titles/headings.
> They have to be embedded in a <title /> tag and have to be placed right before the <verse /> tag.
> They are retrievable using:
> getEntryAttributes()["Heading"]["Preverse"]["0"]
> 
> 
>> Hope this is helpful.
> 
> Yes, very much.
> 
> 
> 
> Manfred
> 
> 
> Am 17.12.2009 um 22:52 schrieb Troy A. Griffitts:
> 
>> Dear Manfred,
>> 
>> On 12/17/2009 12:02 PM, Manfred Bergmann wrote:
>>> Is it necessary to use a VerseKey for positioning in order to retrieve the headings?
>>> 
>> VerseKey::Headings(true|false) is currently how to turn intro records on
>> and off for VerseKey navigated modules.  These include:
>> testament.book.chap.0 for chapter intro
>> testament.book.0 for book intro
>> testament.0 for testament intro
>> 0 for module intro
>> 
>> By default intro's are turned off.
>> 
>> The method name is confusing because 'Headings' was chosen before we had
>> any semblance of OSIS subheadings in verses.  VerseKey::Headings is a
>> prime candidate for a name change when we normalize the API naming
>> conventions in 2.0.
>> 
>>> Which XML/OSIS tags are then used to create the headings in the module?
>>> 
>> DM and others who maintain osis2mod can answer better than me, but I
>> believe these intros are populated from an OSIS doc by osis2mod choosing
>> the interverse text in the correct position, e.g.
>> 
>> <verse osisID="John.1.51">
>> ...
>> </verse>
>> John Chapter 2 intro material
>> <verse osisID="John.2.1">
>> ...
>> </verse>
>> 
>> The API lets you set this material with code like:
>> 
>> VerseKey *vk = (VerseKey *)module.getKey();
>> vk->Headings(true);
>> (*vk) = "jn.2.0";
>> module.setEntry("Intro Text for John 2");
>> The wiki mentions the <title/> tag and that it has to be placed right
>> before the verse/chapter.
>> 
>>> Does this also work for testament and book?
>>> 
>> Text parsing should work for jn.0.0, but I think you have to use some
>> crazy text for text parsing of book and testament headings... 
>> Basically, the text you get out of VerseKey::getText() should work for
>> setting with VerseKey::setText(), but I would suggest just using the
>> setters:
>> 
>> VerseKey::setTestament(0);
>> VerseKey::setBook(0);
>> 
>>> What is the "Headings" global option doing?
>>> 
>> Something entirely different.  These are for sections headings in the
>> text, including 'pre-verse' section headings.  These can be turned on
>> and off.  Headings are the little blurbs before a section like:
>> 
>> The Baptism of Jesus
>> 
>> Some of these are 'pre-verse', which means they should be displayed
>> before your frontend's verse marker.  These can be pulled from
>> entryAttributes, and each SWORD frontend has chapter display logic
>> similar to:
>> 
>>       VerseKey *key = (VerseKey *)currentText.getKey();
>>       VerseKey saveKey = *key;
>> 
>>       if (key->getVerse() != 1) {
>>               key->setChapter(0);
>>       } else {
>>               key->setVerse(0);
>> 
>>       SWBuf text = "<html><body>";
>>       for (; ((key->Chapter() == chapter) && (key->Book() == book) &&
>> !currentText.Error()); currentText++) {
>> 
>>            if (key->getVerse() == 0) {
>>                text += currentText.RenderText();    // intro material
>>                text += "<br/><br/>";
>>                continue;
>>            }
>> 
>>           // see if there are any pre-verse headings
>>           SWBuf preverseHeading =
>> currentText->getEntryAttributes()["Heading"]["Preverse"]["0"].c_str();
>>           if (preverseHeading.length()) {
>>               text += "<br/><br/><b>";
>>               text += currentText.RenderText(preverseHeading); // do
>> any tag conversions for our requested markup
>>               text += "</b><br/><br/>";
>>           }
>> 
>>           // render our verse number marker
>>           text += "<font color=\"#0000ff\"><small>" + key->getVerse()
>> + "</small></font>";
>>       }
>>       text += "</body></html>";
>>       textDisplay->setText(text);
>>       textDisplay->scrollToAnchor("curVerse");
>>       currentText->SetKey(saveKey);
>> 
>>   }
>> 
>> Hope this is helpful.
>> 
>> Troy
>> 
>> 
>>> 
>>> 
>>> Manfred
>>> _______________________________________________
>>> sword-devel mailing list: sword-devel at crosswire.org
>>> http://www.crosswire.org/mailman/listinfo/sword-devel
>>> Instructions to unsubscribe/change your settings at above page
>>> 
>> 
>> 
>> _______________________________________________
>> sword-devel mailing list: sword-devel at crosswire.org
>> http://www.crosswire.org/mailman/listinfo/sword-devel
>> Instructions to unsubscribe/change your settings at above page
> 
> 
> _______________________________________________
> sword-devel mailing list: sword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/sword-devel
> Instructions to unsubscribe/change your settings at above page




More information about the sword-devel mailing list