Re: CSS documentation and non-breakable hyphens



Wondering if there's a better way to do that.

Well, it seems that the most common answer for that problem is to use a
<span> element with the 'white-space' property set to 'nowrap'.

HTML:    <span class="nobr">i-dont-want-to-be-broken</span>
CSS:    span.nobr { white-space: nowrap; }

And this is now how it translates in our GTK XML documentation. We can
use the <phrase> element along with the 'role' attribute. Example with a
table entry from the file css-properties.xml.

    <entry><phrase
role="nobr">-gtk-outline-bottom-left-radius</phrase></entry>

In the generated HTML, it translates to:

    <td><span class="nobr">-gtk-outline-bottom-left-radius</span></td>

Once this is done, the only thing left to do is to tweak the
'style.css', and add this snippet.

    span.nobr { white-space: nowrap; }

It does the job, and would allow to remove every non-breaking spaces and
hyphens. The only detail here is that it requires to modify 'style.css'
file, which belongs to gtk-doc-tools, and is not shipped with gtk.

Anyway, there may be better solution, I'm not a web developer, you
shouldn't trust me too much on that ;)

Cheers.

----

References:

- DOCBOOK: Non breaking spaces or "ties"?
<https://lists.oasis-open.org/archives/docbook/200103/msg00118.html>

- Using CSS to style HTML
<http://www.sagehill.net/docbookxsl/UsingCSS.html#CustomClass>

- White-space property
<https://developer.mozilla.org/en/docs/Web/CSS/white-space?v=control>

On 05/30/2017 05:51 PM, Arnaud wrote:
Hey there,

While browsing the GTK+ CSS documentation lately in my web browser, I
noticed a weird phenomenon. If you do a research on 'font-' (for
example), most of the 'font-' strings are left out of the search results.

You can try it easily. Go on this page, and do a research on 'font-'.
https://developer.gnome.org/gtk3/stable/chap-css-properties.html

The truth behind is that the page uses 'non-breaking hyphens' (U+2011)
instead of 'normal hyphens'. I suppose it works great for formatting,
but it kind of breaks the search function in the browser.

If you're curious about that on your console, browse the GTK+ source
code. And do something like that.

    cd docs/references
    grep -rl $'\xe2\x80\x91' .
    grep $'\xe2\x80\x91' ./gtk/css-overview.xml

I've been even more curious and tried to replace all these non-breaking
hyphens with normal hyphens.

    sed -i 's:\xe2\x80\x91:-:g' css-*.xml

The result is not that bad, but it's true that some property names in
first column of the tables get split in two lines.

Wondering if there's a better way to do that.

Cheers,
Arnaud

_______________________________________________
gtk-devel-list mailing list
gtk-devel-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-devel-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]