Bug: Tidy tab replacement in <pre> elements

Tabs in the first line of HTML <pre> elements are replaced with the
wrong number of spaces.

(This text and the pretab.html example file available at 
http://www.wonkity.com/~wblock/tidy/)

Example unprocessed HTML:

----
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 
Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>Sample with tabs in PRE elements</TITLE
><BODY
<PRE
CLASS="PROGRAMLISTING"
>	  struct driver {
 		KOBJ_CLASS_FIELDS;
 		void	*priv;			/* driver private data */
 	  };</PRE
></BODY
></HTML
>
----

That is a tab and two spaces before "struct".  Now process it with tidy:
% tidy -wrap 90 -raw -preserve -f /dev/null -asxml pretab.html

----
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content=
"HTML Tidy for FreeBSD (vers 7 December 2008), see www.w3.org" />
<title>Sample with tabs in PRE elements</title>
</head>
<body>
<pre class="PROGRAMLISTING">
          struct driver {
                 KOBJ_CLASS_FIELDS;
                 void    *priv;                  /* driver private data 
*/
           };
</pre>
</body>
</html>
----

Note that there are only *nine* spaces instead of ten before "struct", 
and it no longer aligns with the closing bracket.


Tidy versions tested:

FreeBSD port www/tidy (tidy4-20000804_3)
tidy4 -v
HTML Tidy release date: 4th August 2000
See http://www.w3.org/People/Raggett for details

FreeBSD port www/tidy-devel (tidy-devel-090315.c_1)
tidy -v
HTML Tidy for FreeBSD released on 7 December 2008

Received on Monday, 9 January 2012 10:14:02 UTC