W3C home > Mailing lists > Public > html-tidy@w3.org > January to March 2001

Re: Code markup aren't maintained preformatted

From: J. David Bryan <jdbryan@acm.org>
Date: Thu, 8 Feb 2001 16:07:12 -0500
Message-Id: <200102082107.QAA17047@mail.bcpl.net>
To: HTML Tidy List <html-tidy@w3.org>
On 8 Feb 2001, at 16:25, Ludovic Maitre wrote:

> Usually the <code> markups are preformatted (it's not always the case but
> it's often), so when i pass a document into tidy he unwrap all the lines
> contained in <code>. 

That is correct, because <code> is *not* the same as <pre>.  See:

  http://www.w3.org/TR/html4/struct/text.html#h-9.1

It says, in part:

   For all HTML elements except PRE, sequences of white space separate
   "words" [...].  When formatting text, user agents should identify these
   words and lay them out according to the conventions of the particular
   written language (script) and target medium.  

And:

   The PRE element is used for preformatted text [p.97], where white
   space is significant. 


> It's not a correct behaviour because, as you can see in my tidy.conf and
> the attached example file, i don't declare that i want tidy to unwrap
> this markup. 

"Wrap: 0" does not mean "leave the lines exactly as in the source file."  
It means, "do not wrap the lines after processing."  See:

  http://www.w3.org/People/Raggett/tidy/

...and look under "Layout style" to see why this is.


> So please let me know if there is a way for tidy don't unwrap my code
> markup. 

You must put your <code> element inside a <pre> element if you do not want 
it to wrap:

  <pre><code>ab -n 1000 -c 10 -t 30 -v 3 -w \
  http://ubik.inria.fr:8080/index.html</code></pre> 

                                      -- Dave
Received on Thursday, 8 February 2001 16:07:15 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 3 April 2012 06:13:45 GMT