Re: hyphenation in dillo
Jorge Arellano Cid <[email protected]>
| Newsgroups | gmane.comp.web.dillo.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Sebastian,
On Fri, Sep 14, 2012 at 12:38:46PM +0200, Sebastian Geerken wrote:
> On Thu, Sep 13, Alexander Voigt wrote:
> > On Mon, Sep 10, 2012 at 08:45:22PM +0200, Sebastian Geerken wrote:
> > > No, not yet. BTW: I haven't understood whether "xml:" is a normal
> > > namespace prefix (for which namespace?) or is specialy reserved (and
> > > may so not be used as namespace prefix). In the latter case, support
> > > would be rather simple.
> >
> > As written in [1], the "xml:" prefix is bound to the namespace
> > http://www.w3.org/XML/1998/namespace , which is reseved for the W3C.
> > This means that the nobody, except the W3C, can reuse this prefix for
> > their own namespace.
> >
> > So, as long as the meaning of "xml:lang" does not change (which is
> > very unlikely), it can be interpreted in the same way as the "lang"
> > attribute.
>
> So, this simple patch (or similar):
>
> ----------------------------------------------------------------------
> diff -r d0a8d2a5ede3 src/html.cc
> --- a/src/html.cc Thu Sep 13 12:35:54 2012 +0200
> +++ b/src/html.cc Fri Sep 14 12:35:38 2012 +0200
> @@ -3448,6 +3448,15 @@
> html->styleEngine->setNonCssHint(PROPERTY_X_LANG,
> CSS_TYPE_STRING,
> attrbuf);
> }
> +
> + if (tagsize >= 14) { /* TODO prefs.hyphenate? */
> + /* length of "<t xml:lang=i>" */
> + attrbuf = Html_get_attr2(html, tag, tagsize, "xml:lang",
> + HTML_LeftTrim | HTML_RightTrim);
> + if (attrbuf)
> + html->styleEngine->setNonCssHint(PROPERTY_X_LANG,
> CSS_TYPE_STRING,
> + attrbuf);
> + }
> }
>
> static void Html_display_block(DilloHtml *html)
> ----------------------------------------------------------------------
>
> would work, without bothering about XML namespaces (in the near
> future). What do the other developers think?
Yes, it looks OK to me.
I'd go with the attached patch (a bit more explicit, +comments)
Feel free to commit.
--
Cheers
Jorge.-
_______________________________________________
Dillo-dev mailing list
[email protected]
http://lists.auriga.wearlab.de/cgi-bin/mailman/listinfo/dillo-dev
lang2.diff
(text/x-diff, 1005 B)
diff -r 072191f79fab src/html.cc
--- a/src/html.cc Tue Sep 25 17:53:30 2012 +0000
+++ b/src/html.cc Wed Sep 26 11:57:05 2012 -0300
@@ -3480,7 +3480,19 @@ static void Html_parse_common_attrs(Dill
html->styleEngine->setStyle (attrbuf);
}
- if (tagsize >= 10) { /* TODO prefs.hyphenate? */
+ /* handle "xml:lang" and "lang" attributes */
+ int hasXmlLang = 0;
+ if (tagsize >= 14) {
+ /* length of "<t xml:lang=i>" */
+ attrbuf = Html_get_attr2(html, tag, tagsize, "xml:lang",
+ HTML_LeftTrim | HTML_RightTrim);
+ if (attrbuf) {
+ html->styleEngine->setNonCssHint(PROPERTY_X_LANG, CSS_TYPE_STRING,
+ attrbuf);
+ hasXmlLang = 1;
+ }
+ }
+ if (!hasXmlLang && tagsize >= 10) { /* 'xml:lang' prevails over 'lang' */
/* length of "<t lang=i>" */
attrbuf = Html_get_attr2(html, tag, tagsize, "lang",
HTML_LeftTrim | HTML_RightTrim);