[sword-devel] Preverse Headings titles/divs

Troy A. Griffitts scribe at crosswire.org
Tue Apr 15 14:52:07 MST 2014


Dear all SWORD frontend developers.

In the 1.7 codebase we introduced the new concept of preverse divs 
instead of simply a set of preverse titles.  This was discussed at 
length over the years and we decided to move in this direction with 
everyone' consent, hopefully.

We had an inconsistency in 1.7.[0-2] which I have just fixed and which 
you probably need to worry about:


The problem:

Previous, we were including preverse titles in the entryAttributes under:

["Heading"]["Preverse"]["0" ... n] = "Some Title"

You were probably wrapping this in a nice <h2> or something and being 
done with it.

In the new world of preverse divs which can contain anything-- not just 
titles, this would look like this:

["Heading"]["Preverse"]["0" ... n] = "<title>Some Title</title>"

This was inconsistent.  The former relied on the frontend to set this 
apart as a title.  The later has the <title> tag included in whatever 
might be a title in the preverse material.

The problem is that most of you (and me) didn't change any of our 
frontend code to handle the move to preverse div.  We tried to make this 
as easy of a transition as possible and thought we did, but not quite 
good enough.

As it stands now, for older modules, you're probably rendering something 
like:

<h3>Some Title</h3>

But for newer modules you are probably rendering something like:

<h3><h3>Some Title</h3></h3>

You were adding your own markup to highlight these always as titles, and 
in the new world, the highlighting is done for you, if it is indeed a 
title (the OSIS <title> tag is actually in the body of the material and 
will get rendered as all other <title> elements).

A bug fix, which I've just committed and will go out in 1.7.3 shortly, 
will make these consistent.  When processing headings, I am looking for 
old preverse title modules and I now preserve the containing "<title>" 
element.  This will make them act the same as the newer preverse div 
modules and both will appear consistently as:

["Heading"]["Preverse"]["0" ... n] = "<title>Some Title</title>"


SUMMARY:  In the new preverse div world, you should never add your own 
markup around the preverse material which assumes the entire content is 
a title.  Simply remove your added markup and you should be good.





More information about the sword-devel mailing list