Bug: Tidy tab replacement in <pre> elements

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Bug: Tidy tab replacement in <pre> elements

Warren Block
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



Reply | Threaded
Open this post in threaded view
|

Re: Bug: Tidy tab replacement in <pre> elements

Bjoern Hoehrmann
* Warren Block wrote:
><PRE
>CLASS="PROGRAMLISTING"
>>  struct driver {

This is tab space space.

> KOBJ_CLASS_FIELDS;
> void *priv; /* driver private data */
>  };</PRE

This space tab space space.

><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.

In your mail I see ten spaces before struct and eleven spaces before the
closing curly bracket. I can reproduce what I just described, basically
the problem would be that the closing `>` for the <pre> start tag isn't
ignored during tab replacement?

It would be good if you could raise this bug on the SourceForge tracker
<https://sourceforge.net/tracker/?group_id=27659&atid=390963>, but you
will notice there is a long backlog and not much activity.
--
Björn Höhrmann · mailto:[hidden email] · http://bjoern.hoehrmann.de
Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de
25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 

Reply | Threaded
Open this post in threaded view
|

Re: Bug: Tidy tab replacement in <pre> elements

Warren Block
On Mon, 9 Jan 2012, Bjoern Hoehrmann wrote:

> * Warren Block wrote:
>> <PRE
>> CLASS="PROGRAMLISTING"
>>>  struct driver {
>
> This is tab space space.
>
>> KOBJ_CLASS_FIELDS;
>> void *priv; /* driver private data */
>>  };</PRE
>
> This space tab space space.
>
>> <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.
>
> In your mail I see ten spaces before struct and eleven spaces before the
> closing curly bracket.

Could be email client display or quoting.  The sample file at
http://www.wonkity.com/tidy/pretab.html is fixed now, so it renders
correctly in a browser.  Same result after tidy, too.

> I can reproduce what I just described, basically the problem would be
> that the closing `>` for the <pre> start tag isn't ignored during tab
> replacement?

Sounds reasonable.

> It would be good if you could raise this bug on the SourceForge tracker
> <https://sourceforge.net/tracker/?group_id=27659&atid=390963>, but you
> will notice there is a long backlog and not much activity.

I did try to add it earlier, but it wanted me to create a sourceforge
account.  Having done that, I think this bug may be the same thing:
https://sourceforge.net/tracker/?func=detail&aid=1885471&group_id=27659&atid=390963

Should I still enter a new one?

Thanks for the quick response!