[sword-devel] SWORD handling of OSIS paragraphs

DM Smith dmsmith at crosswire.org
Sat Jun 6 08:29:50 MST 2009

I'm looking at Chris' request regarding osis2mod's handling of  
paragraph tags and also Mattias expressed frustration.

So this has led to looking at the SWORD engine.

In SWORD's HTML render filter for OSIS (osishtmlhref) paragraphs are  
handled in the following manner:
                 // <p> paragraph tag
                 else if (!strcmp(tag.getName(), "p")) {
                         if ((!tag.isEndTag()) && (!tag.isEmpty()))  
{    // non-empty start tag
                                 outText("<!P><br />", buf, u);
                         else if (tag.isEndTag()) {      // end tag
                                 outText("<!/P><br />", buf, u);
                                 userData->supressAdjacentWhitespace =  
                         else {                                  //  
empty paragraph break marker
                                 outText("<!P><br />", buf, u);
                                 userData->supressAdjacentWhitespace =  

In comparing with the ThML to HTML filter (thmlhtml) the paragraph is  
passed as is.

First question: What does <!P> and <!/P> mean? (There is one place on  
osishtmlhref that <!p> is output too.)

I found a comment in the GBF to HTML filter (gbfhtml) that it is  
something that front-ends can choose to handle or not.
	// paragraph <!P> is a non showing comment that can be changed in the  
front end to <P> if desired

However, the construct is not valid html. It is neither a comment  
( <!-- comment --> ) or a processor instruction (<?P>).

Here is a page for xhtml 1.1 that is otherwise valid:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd 
<html xmlns="http://www.w3.org/1999/xhtml" version="-//W3C//DTD XHTML  
1.1//EN" xml:lang="en"
       xsi:schemaLocation="http://www.w3.org/1999/xhtml http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd 
This is a test of &lt;!P&gt;
<br />
and &lt;/P&gt;
<br />

Second question:
Is is appropriate for the filter to output a <br /> everywhere a <p>  
is found?

Third question:
Why not just output <p>? Why is this needed at all? If it is needed,  
can we change it to something that is valid HTML? That is, can't we do  
it better?

Fourth question:
Which front-ends use this filter? Is it just SwordWeb and Xiphos?  
Others? And which of these care about this construct? That is, what is  
the impact if this changes?

In Him,

More information about the sword-devel mailing list