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

Re: Tidy converts "--" in comments...

From: Richard O'Keefe <ok@cs.otago.ac.nz>
Date: Mon, 1 Mar 2010 13:55:00 +1300
Cc: html-tidy@w3.org
Message-Id: <4098D6A4-AF73-46E3-969C-0C38CA41EFFF@cs.otago.ac.nz>
To: Dennis Kowallek <kowallek@iglou.com>

On Feb 28, 2010, at 5:47 AM, Dennis Kowallek wrote:

> I am running tidy.exe for windows dated 22 March 2008.
>
> I have "fix-bad-comments: no" in the cfg file. But tidy converts  
> "--" in
> comments to "-=".
>
> I would like tidy to leave these alone. What am I doing wrong?

SGML and XML comments simply are not allowed to contain "--".
If you leave those bad comments alone, then many XML parsers
*will* break.  Tidy is telling you about a serious foulup in
your data and trying to help you.

<SGML Comment> ::=
     "<!" ("--"([-]?[^-])*"--" sp*)* ">"
     E.g., <!>, <!--a-b-c--> <!--a-b--  --c-d-e--  --f-g--  >

<XML Comment> ::=
     "<!--" ([-]?[^-])* "-->"
     E.g., <!--a-b-c-->

<!--------> *is* an SGML comment, as is anything with exactly
4n dashes between the "<!" and the ">", because it's actually
n comment segments.  But it is not an XML comment, and
<!-------> is *not* an SGML comment (7 not being a multiple of 4).
XML comments may only have one segment, which means no "--" *ever*
between "<!--" and "-->".
Received on Monday, 1 March 2010 00:56:01 GMT

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