dealing with new-lines

Thomas A. Fine <fine@cis.ohio-state.edu>
Date: Thu, 7 Jan 93 16:27:50 -0500
From: Thomas A. Fine <fine@cis.ohio-state.edu>
Message-id: <9301072127.AA07870@soccer.cis.ohio-state.edu>
To: www-talk@nxoc01.cern.ch
Subject: dealing with new-lines
X-Mailer: Perl Mail System v1.1

How should browsers deal with new-lines, and where can html-generators
put in new-lines?

I spent quite a bit of time thinking about what is intuitively the right
way to do it, and I came up with this method.

0. Convert all new-lines inside of tags to spaces.

1. For each tag NOT in
     <PRE> </PRE> <A> </A> <PLAINTEXT>
   remove ALL surrounding new-lines.

2. For each tag in
     <PRE> <PLAINTEXT>
   remove ALL new-lines to left, and one new-line to the right.

3. For each tag in
     </PRE>
   remove ALL new-lines to the right.

4. Convert all remaining new-lines to spaces.

If XMP and LISTING sections are being used, they would be treated the
same as PRE.

Note that this converts new-lines around anchors into spaces UNLESS they
appear immediately at the beginning or end of some other element.

If browsers use this method, it would allow html-generators to put in
new-lines all over the place for readability of HTML, without introducing
lots of annoying extra spaces in the output.  This is what seems like
the most useful thing to do, although I'm not sure it is "correct".

So is it correct?  And are there any obvious flaws?

       tom