On Sun, Mar 17, 2019 at 10:07:29AM -0400, Karl Kleinpaste wrote:
> However, for this purpose, the deeper problem is that Sword erroneously
> generates self-closing <div> tags, which do not work. Search "html
> self-closing div" and discover all the conflicting noise over it. My
> solution in Xiphos was simply to obliterate these tags in introductory
> material; they have no visual manifestation and I don't know why the
> XHTML filters pass them in the 1st place. They look like
> 
> <div sID="gen34165" type="introduction"/>
> 
> and they caused my .introMaterial change to bleed throughout the chapter
> until I implemented the obliteration. See
> https://github.com/crosswire/xiphos/issues/845

It sounds like you’re trying to render XHTML using an HTML
parser. Oftentimes, you can switch an HTML parser to XML mode by
prefixing your XHTML with <?xml version="1.0"?>. Or by specifying the
Content-Type header as application/xhtml+xml (not sure how you do that
with embedded engines). Or you could preprocess the XHTML into HTML
first by parsing the XHTML with an XML parser and then serializing it
with an HTML serializer so that it is OK to feed to the HTML parser
(using xmllint as an example which sort of gets close):

    $ echo '<div class="my-class"/>asdf<div/>' | xmllint --html - | grep -e div
    <div class="my-class"></div>asdf<div></div>

-- 
binki

Don’t forget to check for missing or extraneous apostrophes!

Attachment: signature.asc
Description: Digital signature

_______________________________________________
sword-devel mailing list: sword-devel@crosswire.org
http://www.crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page

Reply via email to