[BUGFIX] Tidy erroneously lists "doctype given"

This report is for HTML Tidy version 4-Aug-00.  Problem description, 
verification, and fix are contained within the appended HTML text.

                                            -- Dave


--------------------------- test case -----------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">

<!--
                          bug-2000-12-27-a.html

Problem:
  Running Tidy on this file produces the diagnostic:

    Doctype given is "-//W3C//DTD HTML 3.2//EN"

  ...when clearly the DOCTYPE is not as shown.  Problem appears to be that
  doctype is "fixed" in FixDocType before it is reported in ReportVersion.
  See "tidy.c" lines 1001, 1016.

Expected behavior:

  The DOCTYPE that appears in the file should be reported in the "Doctype
  given" diagnostic.

Verification:
  tidy -e bug-2000-12-27-a.html

Correction:
  tidy.c (main)
-->

<html>

<head>
<title>Bug-2000-12-27-A</title>
</head>

<body>

<table>
<tr>
<td>A cell.</td>
</tr>
</table>

</body>
</html>
----------------------------- patch -----------------------------------
diff -u tidy4aug00-orig/tidy.c tidy4aug00-fix/tidy.c
--- tidy4aug00-orig/tidy.c      Fri Aug 04 17:01:06 2000
+++ tidy4aug00-fix/tidy.c       Thu Jan 04 00:34:20 2001
@@ -995,6 +995,8 @@
 
                 if (document->content)
                 {
+                    ReportVersion(errout, lexer, file, doctype);
+
                     if (xHTML)
                         SetXHTMLDocType(lexer, document);
                     else
@@ -1012,10 +1014,7 @@
                 totalerrors += lexer->errors;
 
                 if (!Quiet && document->content)
-                {
-                    ReportVersion(errout, lexer, file, doctype);
                     ReportNumWarnings(errout, lexer);
-                }
             }
 
             if (input != stdin)
--------------------------- end patch ---------------------------------

                                      -- Dave

Received on Thursday, 4 January 2001 15:07:16 UTC