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

Not changing whitespace in certain elements

From: Warren Block <wblock@wonkity.com>
Date: Fri, 6 Jan 2012 19:32:05 -0700 (MST)
To: html-tidy@w3.org
Message-ID: <alpine.BSF.2.00.1201061908580.11409@lightning.wonkity.com>
FreeBSD uses tidy to clean up DocBook-generated HTML.  For example,
   tidy -wrap 90 -m -raw -preserve -f /dev/null -asxml  book.html

But some of the output is from <programlisting> elements, which may 
contain tabs that should be kept verbatim.  Here's a pre-tidy example 
with added line numbers:

  1  <PRE
  2  CLASS="PROGRAMLISTING"
  3  ><TT
  4  CLASS="FILENAME"
  5  >sys/boot/i386/boot2/Makefile:</TT
  6  >
  7  boot2: boot2.ldr boot2.bin ${BTX}/btx/btx
  8          btxld -v -E ${ORG2} -f bin -b ${BTX}/btx/btx -l boot2.ldr \
  9                  -o boot2.ld -P 1 boot2.bin</PRE
10  ><P
11  >

Line 8 starts with a tab, and line 9 starts with two tabs.  This 
particular example is from a Makefile, where tabs are significant.  Left 
alone, the text can be copied from the browser, and the tabs are obvious 
from the highlighting.  But tidy replaces the tabs with spaces.

Is there a way to get tidy to leave whitespace alone inside this class 
of <pre> elements?

Thanks!
Received on Monday, 9 January 2012 10:14:02 GMT

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