Greg Ward wrote:
> David -- I've been playing around with Docutils' HTML output and
> default.css, and I think it's possible to tighten up treatment of
> inline literal text a bit. In particular, this:
>
> <tt class="literal"><span class="pre">...</span></tt>
>
> can be rendered as
>
> <tt class="literal">...</tt>
>
> if you just add this:
>
> tt.literal {
> white-space: nowrap
> }
>
> to default.css.
I actually tried the same thing, back when we were discussing
line-wrapping at hyphens WRT both Docutils and textwrap. The problem
with a "white-space: nowrap" style on the entire <tt> is that
sometimes ``inline literal text`` is longer than one line and
therefore *should* wrap. Sometimes the line in the source is wrapped,
but the rendered output doesn't need to wrap. Even if the line isn't
so long, wrapping often helps. Adding all those <span> tags is an
attempt (that doesn't work in all browsers) to prevent wrapping inside
words or at hyphens, but I think wrapping at whitespace is kosher.
Inline literals are *supposed* to flow.
If the author doesn't want any line wrapping at all, they should use
literal blocks.
--
David Goodger <go...@us...> Open-source projects:
- Python Docutils: http://docutils.sourceforge.net/
(includes reStructuredText: http://docutils.sf.net/rst.html)
- The Go Tools Project: http://gotools.sourceforge.net/
|