[sword-devel] Headings, Titles and Intros
Troy A. Griffitts
scribe at crosswire.org
Thu Dec 17 16:18:21 MST 2009
Sorry, I usually ignore my many typos, but some of these are in code...
fixed below:
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");
>
These next 2 lines below were left over from the original message but
looked like it was part of my reply:
> The wiki mentions the <title/> tag and that it has to be placed right
> before the verse/chapter.
> ... 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->getChapter() == saveKey->getChapter() && key->getBook() == saveKey.getBook() &&
> !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>";
// render verse body
text += currentText.RenderText();
}
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
>
More information about the sword-devel
mailing list