W3C home > Mailing lists > Public > www-html@w3.org > February 1999

Re: Line feeds in PRE blocks

From: Tim Bagot <tsb@earth.li>
Date: Sat, 13 Feb 1999 13:13:37 +0000 (UTC)
To: HTML mailing list <www-html@w3.org>
Message-ID: <Pine.LNX.3.96.990213124814.17638A-100000@c32.keble.ox.ac.uk>
On Fri, 12 Feb 1999, Inanis Brooke wrote:

> ...|Does this mean that the following:
> |
> | <PRE>
> |   Oranges
> |   Lemons
> | </PRE>
> |
> |...where each line is separated by a linefeed character (i.e., where
> |the document was created on Unix), and the following:
> |
> | <PRE>   Oranges   Lemons </PRE>
> |
> |...should be parsed as being the same thing?
> |
> |And therefore, does it mean that any PRE blocks in HTML files that
> |have lines separated only by linefeed characters (as opposed to
> |carriage returns (SGML "RE" characters, code point 13)) should be
> |rendered as a single continuous line?

In theory at least, this would appear to be the case. Fortunately, no
implementation of HTML of which I am aware uses SGML directly. This is
certainly not the only area where HTML does not adhere strictly to SGML.
SGML puts certain constraints on the maximum lengths of various things;
The SGML declaration for HTML puts most of them at the maximum permitted
values (e.g. 65536), although it is recommended that user agents ignore
these limits.

I may or may not apply the appropriate transformation to my own documents,
but I suspect that this is not really necessary.

> Okay, I admit that I'm no help here. I just wanna say, "Wooaa, that's deep."
> I thought that <pre> was an element that doesn't get used too frequently, am
> I wrong?

Although the use of PRE is not frequent, this element can be very useful
in certain circumstances. I, for example, use it quite often for computer
code of one sort or another, since this requires line breaks is specific
places and tends to be more readable in a fixed-width font. Another
application is is with mathematical formulae, where "ASCII art"  is
arguably superior to images in some cases.

> Also, would the answer to this question involve how the OS renders text, or
> is it entirely dependent upon the web client software? (my curiosity.)

It really is entirely dependent on the particular implementation. Of
course, it is quite possible that a user agent might employ library calls
provided by the OS in its text processing. 

Tim Bagot
Received on Saturday, 13 February 1999 08:19:36 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:15:38 GMT