[sword-devel] SWORD handling of OSIS paragraphs
Chris Little
chrislit at crosswire.org
Sat Jun 6 12:21:25 MST 2009
The *htmlhref filters are the GnomeSword filters. They may now be used
by other front ends, and the GnomeSword/Xiphos team may have abandoned
their maintenance, but they were originally written by Terry and do some
non-standard stuff (as opposed to the *html filters, which should just
output valid html fragments). They were included in Sword long ago at
his request.
So, while others may happen to know the purpose of all of these <!P>s,
it's also possible that the only ways of determining their purpose and
the answers to your questions would be to ask Terry or dig through the
code of Xiphos (or possibly an old version of GnomeSword).
--Chris
DM Smith wrote:
> 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 = true;
> }
> else { // empty
> paragraph break marker
> outText("<!P><br />", buf, u);
> userData->supressAdjacentWhitespace = true;
> }
> }
>
> 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"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://www.w3.org/1999/xhtml
> http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd"
> >
> <head>
> <title>test</title>
> </head>
> <body>
> <div>
> This is a test of <!P>
> <!P>
> <br />
> and </P>
> <!/P>
> <br />
> </div>
> </body>
> </html>
>
> 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,
> DM
>
> _______________________________________________
> 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