[sword-devel] Vertical whitespace

DM Smith dmsmith at crosswire.org
Sat Jan 19 14:12:56 MST 2013

I've noticed that OSIS modules sometimes render with a lot of vertical whitespace (blank lines).

I'd like for this to be sorted as part of the next release. I don't think it'd be too hard. I've been in the osishtmlhref filter to see if I could figure it out, but it is beyond me.

So this is a suggestion for others.

Using the HTML notion of block and inline elements, I think we can classify OSIS elements as block or inline. Off the top of my head, <div>, <chapter>, <p>, <lb/>, <lg>, <l>, <title>, <table> and <row> are the block elements.
The key feature of a block element is that block elements that follow each other stack one on top of each other.
Some block elements allow nesting, such as <div>.

In HTML, an empty <div> occupies no vertical space. A nested div does not cause additional vertical space.

In HTML, a <p> has semantics as to whether it is preceded or followed by whitespace. A <p> at the beginning of a document is not preceded by a blank line. Nor is a </p> at the end of a document. This is also true after a heading element.

I think that the SWORD renderers always cause a <div> to occupy vertical whitespace.

The other issue with <div> is that we now have a "pre-verse" div, which is a great way of marking off what stands before a verse, but this <div> really shouldn't have any <div> semantic. It probably would have been better if we used <milestone> instead.

I seem to remember that there is a "swollow" flag for whitespace (I think it might be for horizontal whitespace.) I think something like this could be used for vertical whitespace.

The other part to this is when a chapter is shown verse-per-line. If because of rendering the pre-verse content the verse already starts on a new line, I don't think more vertical whitespace should be produced.

Together in His Service,

More information about the sword-devel mailing list