[sword-devel] trying to get proper xhtml to work in webkit
Troy A. Griffitts
scribe at crosswire.org
Sat Apr 18 14:25:02 MST 2020
Hey Karl,
Do you have a module and entry key value I can use for testing?
Troy
On 4/18/20 2:10 PM, Karl Kleinpaste wrote:
> On 4/18/20 2:48 PM, Greg Hellings wrote:
>> This is the HTML header. Not the HTTP header.
>
> I had thought that's what the <meta http-equiv=\"content-type\"
> content=\"application/xhtml+xml; charset=utf-8\">was supposed to give
> me, for the case of a directly-loaded text blob that didn't arrive via
> HTTP. Apparently not.
>
>> For manually loading the text you don't have an HTTP header, but you
>> still tell the widget what content type when you call
>> wk_html_open_stream or webkit_web_view_load_string or similar
>> functions. It's this value that is telling Webkit what to do.
>
> <headdesk>
>
> It hadn't occurred to me that this was done other than in the header
> directives as I began to fill the widget.
>
> Unfortunately, still no joy. There are 6 occurrences of "text/html" in
> 3 files that do webkit widget loading:
> src/editor/editor.c
> src/editor/webkit_editor.c
> src/webkit/wk-html.c
> And the one that is immediately relevant is of course the last, which
> has 1 of the 6. Changing them all from "text/html" to
> "application/xhtml+xml" had precisely zero effect. The self-closing
> <div> still makes my .introMaterial bleed through to the end of the
> chapter.
>
> I can't win. Sorry. I think I'm done with this exercise in madness.
>
> For the record, this is the patch that restores <div/>-non-destructive
> behavior, with which I've been testing all these variants. The <meta>
> is gone, all the other <?xml> and DOCTYPE are gone, all that's added
> is the namespace spec, plus the code change proper that simply pastes
> the engine's returned content into the widget, rather than engaging
> the <div/> wiping.
>
> Ohwell. I tried.
>
> --- src/main/display.cc 2020-04-18 16:39:59.743635867 -0400
> +++ ../databits/display.cc.FAIL 2020-04-18 16:44:35.607215035 -0400
> @@ -89,7 +89,7 @@
> N_("<br/><br/><center><i>This module has no content at this
> point.</i></center>");
>
> #define HTML_START \
> - "<html><head><meta http-equiv=\"content-type\"
> content=\"text/html; charset=utf-8\"> \
> + "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head> \
> <style type=\"text/css\"><!-- \
> A { text-decoration:none } \
> *[dir=rtl] { text-align: right; } \
> @@ -1181,6 +1181,12 @@
> key->setChapter(i * chapter);
> key->setVerse(0);
>
> +#if 1
> + buf = g_strdup_printf("%s<br />",
> + (strongs_or_morph
> + ? block_render(imodule.renderText().c_str())
> + : imodule.renderText().c_str()));
> +#else
> // begin gosh this is gross.
> // hunt down self-closing <div ... /> and stomp them with spaces.
> // this is disgustingly special-case, caused by self-closing
> <div>
> @@ -1217,6 +1223,7 @@
> g_string_free(divBuf, TRUE);
>
> // end grossness
> +#endif /* 0 */
>
> swbuf.append(buf);
> g_free(buf);
>
>
> _______________________________________________
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/sword-devel/attachments/20200418/d4d6617b/attachment-0001.html>
More information about the sword-devel
mailing list