Re: Code markup aren't maintained preformatted

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 UTC