[sword-devel] trying to get proper xhtml to work in webkit
greg.hellings at gmail.com
Thu Apr 16 20:08:09 MST 2020
On Thu, Apr 16, 2020 at 9:31 PM Karl Kleinpaste <karl at kleinpaste.org> wrote:
> From discussion here in March of last year, I am attempting to get Xiphos
> to operate in a proper xhtml mode, rather than its apparent heretofore html
> mode, because I honestly wasn't aware that WebKit could operate other than
> xhtml in the first place. The specific goal is to leave self-closing <div>
> tags alone, as delivered by the Sword engine, rather than having to
> obliterate them in a post-delivery hack. To this end, using suggestions
> from Nathan Phillip Brink at the time, I've made this change to the opening
> stanza of Xiphos' main display widget:
> #define HTML_START \
> - "<html><head><meta http-equiv=\"content-type\"
> content=\"text/html; charset=utf-8\"> \
> + "<?xml version=\"1.0\"?> \
> +<!DOCTYPE html> \
This line is wrong. <!DOCTYPE html> will give you HTML 5, not XHTML. XHTML
would be much wordier:
> <http://www.w3.org/1999/xhtml%5C>> \
> +<head><meta http-equiv=\"content-type\" content=\"application/xhtml+xml;
> charset=utf-8\"> \
> - begins with <?xml...> line
Doesn't seem to be strictly needed by browsers for XHTML rendering, but it
shouldn't hurt, either.
- includes DOCTYPE (either html or xhtml) (also tried leaving this off
> entirely, no diff)
You will almost certainly need this to put the browser into XHTML mode
- adds namespace to <html>
That will be needed, for sure.
- changes content type to application/xhtml+xml (also tried just xhtml, no
That's not necessary to get you into XHTML mode.
> Result so far is an all around no-joy. I am evidently still getting WebKit
> behavior in HTML mode because the self-closing <div> leads to my
> .introMaterial format/color change bleeding through to the end of the
> chapter, as most clearly seen in the (technically defunct, but I still have
> & use it) ESV2011 module, in every book's 1:1. If I leave the post-delivery
> hack in place, the self-closing <div> is eliminated entirely, and the
> .introMaterial section is properly highlighted.
So here's a thing I've learned:
The moment a browser finds anything that violates the XHTML standards it
will dump you back into HTML 4.01 mode. That seems to be what you're
getting, because <div/> is valid in XHTML but not in HTML 4.01. Secondly,
all browsers ignore the doctype declaration at the top of a file. At least
all modern browsers do. They only thing they care about is the
Content-Type: in the HTTP header. Of course, you don't have an HTTP header,
but surely you have a way to set it to "application/xhtml+xml"?
> Can anyone offer any further suggestions on how to induce the right sort
> of behavior?
> sword-devel mailing list: sword-devel at crosswire.org
> Instructions to unsubscribe/change your settings at above page
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the sword-devel