[sword-devel] Bible Chapter Titles?

DM Smith dmsmith555 at yahoo.com
Mon Jun 16 19:42:40 MST 2008

On Jun 16, 2008, at 9:23 PM, Greg Hellings wrote:

> I'm looking through the mod2osis.cpp file, trying to bring its output
> closer into the form of the module inputs (basing it off of the result
> of running the tool as compared to the KJV input files).  So far I
> seem to have the following problems - I can't seem to find where (or
> if) the following information is maintained and retrieved from the
> Sword API:

I don't think mod2osis has been kept current with the changes to osis  
nor with osis2mod.

mod2osis, if I understand, will also create osis output for plaintext,  
gbf and ThML modules. I don't think these filters are robust.

Since you are talking about being able to round trip a module created  
with osis2mod, I'll mention what it does.

> 1) Where is the equivalent information from the OSIS block below
> maintained?  Is it maintained?

osis2mod takes an xml file which is presumed to be valid OSIS and  
based upon that assumption, looks for testament, book, chapter and  
verse content.

It ignores everything in the header element.

> There is brief mention of Strongs data
> and such in the .conf file, but is that enough to go off of to
> recreate this information in general?

There is not quite enough info in the conf to recreate the header.
Specifically, there are several variants of the work prefix for  
Strong's numbers and for morphology. Without digging into the module,  
it is not possible to know what the work ids are. It is possible for  
us to have a generic header that encodes all the possibilities.

Also, the conf does not encode the scope of the work, which is a  
typical part of the header. To get it exact, one would have to dig  
into the module.

> Perhaps this information should
> be part of a standard .xsl file which we include in tools avialable
> for module creators to run.  Have it output a basic .conf file with
> the information from the OSIS document and preserve information like
> this in it somewhere?
> <   <work osisWork="strong">
> <     <refSystem>Dict.Strongs</refSystem>
> <   </work>
> <   <work osisWork="robinson">
> <     <refSystem>Dict.Robinsons</refSystem>
> <   </work>
> <   <work osisWork="strongMorph">
> <     <refSystem>Dict.strongMorph</refSystem>
> <   </work>
> 2. Chapter titles?
> How do you test for the presence of a chapter title?

There are testament, book and chapter titles. These have special  
notations using 0 as the index.

For example John 1:0 is the chapter title for chapter 1 and John 0:0  
is the book title.

In osis2mod, the content of these are determined by the placement of  
the text. To simplify: If it stands after the opening of a book but  
before the opening of a chapter, then it is a book title. If it stands  
after the opening of a chapter, but before the beginning of a verse,  
it is a chapter title.

We can also have titles that are between verses. These are pre-pended  
to the verse content and marked as pre-verse.

>  In the following
> block, the chapter title itself is easy enough to recreate but at the
> expense of portability to someone else who wants to give
> chapterTitle="The E Creation Tale" or some such thing, but I can't
> find access to the information maintained in the <title...> tag.  Is
> this information maintained, and if so, how is it accessed?

The only thing that is maintained is the actual content of the verse,  
chapters, books, ..., but not of those elements themselves.

>  It seems
> like it would be useful to have, as many Bible editors insert
> information like this into the the flow of the text.
> < <title type="main">THE FIRST BOOK OF MOSES CALLED GENESIS</title>
> < <chapter osisID="Gen.1" chapterTitle="CHAPTER 1.">
> 3. Milestoneable verse boundaries?
> It doesn't seem that mod2osis has any support for milestone verse
> tags, is this correct?

I'm not sure I understand. The module contains no notion of verse  
tags, milestoned or otherwise. In reconstructing the module, it is  
important to know as one outputs the content of a verse whether it is  
well-formed, in and of itself, or not. And since OSIS requires that if  
the milestoned form is used in one location, it is used consistently  
everywhere, the only safe output from mod2osis for a verse tag is  

>  How would one programaticly detect this, as
> well as other milestone elements?  Somewhere, though, it's producing
> output like this:
> <milestone type="x-extra-p"/>
> Is that coming from the markup filter?  That's the only explanation I
> can find for it.  However, I'm not sure that there's an example of
> milestone-support in the KJV document which can be used for testing
> that support.

osis2mod in order to construct well-formed verses takes the <p>  
element (which is the only container element in OSIS that cannot be  
milestoned) and replaces it with <lb type="x-paragraph-begin"/> and  
<lb type="x-paragraph-end"/> (I am doing this from memory, so the  
attribute value might be a bit different.)

Hope that helps.
> I'll pass along other questions as I see them.

Looking forward to them.

You might want to look at JSword's  
org.crosswire.jsword.examples.BibleToOSIS that I used to re-create the  
KJV OSIS from the module when I was working on the current version of  
the KJV module. Currently, it just wraps the raw text, with minor  
modifications to product the module. However,  with a simple change  
this can be tied to very robust filters for GBF, PlainText, ThML and  

In Him,

More information about the sword-devel mailing list