Re: twisted.web.template output encoding

Jonathan Jacobs <[email protected]>
Newsgroups gmane.comp.python.twisted.web
Message-ID <CAM187SGqXXrpKaebsYprTfFBNV-oeKD5jh9EABvgZMw=0avJtw@mail.gmail.com>
On Mon, Dec 5, 2011 at 22:19, Glyph <[email protected]> wrote:
> Looking at the actual output now, these &nbsp; characters strike me as an
> accident of how browsers collapse different types of whitespace.  They could
> be replaced with a <span style="width: 4em;" /> to avoid this problem for
> now, which is probably more expressive.

The "width" property does not apply to non-replaced inline elements
(i.e. "display: inline", like span) [1], "padding-left: 4em" produces
the same result though.

Apart from the fact that "padding-left: 4em" (or "width: 4em") will
not be preserved if you attempt to copy the text,
&nbsp;&nbsp;&nbsp;&nbsp; and width: 4em are not actually the same
thing and do not produce the same result, even with a monospace font.

I've attached a small document demonstrating this.

[1] <http://www.w3.org/TR/CSS2/visudet.html#the-width-property>

-- 
Jonathan

_______________________________________________
Twisted-web mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
test.html (text/html, 459 B)
<html>
    <head>
        <style type="text/css">
            body, pre {
                font-family: monospace, monospace;
                margin: 0;
                padding: 0;
            }
        </style>
    </head>
    <body>
        <pre>    test</pre>
        <div>&nbsp;&nbsp;&nbsp;&nbsp;test</div>
        <div><span style="display: inline-block; width: 4em"></span>test</div>
        <div style="padding-left: 4em">test</div>
    </body>
</html>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.