Skip to content

Commit 7f0d5c3

Browse files
committed
If no doctype, allow user doctype to reset table - Issue #342
1 parent 6abb8b7 commit 7f0d5c3

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/parser.c

+11-2
Original file line numberDiff line numberDiff line change
@@ -4743,12 +4743,21 @@ void TY_(ParseDocument)(TidyDocImpl* doc)
47434743
/*\
47444744
* #72, avoid MISSING_DOCTYPE if show-body-only.
47454745
* #191, also if --doctype omit, that is TidyDoctypeOmit
4746+
* #342, adjust tags to html4-- if not 'auto' or 'html5'
47464747
\*/
4747-
if (!TY_(FindDocType)(doc) && !showingBodyOnly(doc))
4748+
if (!TY_(FindDocType)(doc))
47484749
{
47494750
ulong dtmode = cfg( doc, TidyDoctypeMode );
4750-
if (dtmode != TidyDoctypeOmit)
4751+
if ((dtmode != TidyDoctypeOmit) && !showingBodyOnly(doc))
47514752
TY_(ReportError)(doc, NULL, NULL, MISSING_DOCTYPE);
4753+
if ((dtmode != TidyDoctypeAuto) && (dtmode != TidyDoctypeHtml5))
4754+
{
4755+
/*\
4756+
* Issue #342 - if not doctype 'auto', or 'html5'
4757+
* then reset mode htm4-- parsing
4758+
\*/
4759+
TY_(AdjustTags)(doc); /* Dynamically modify the tags table to html4-- mode */
4760+
}
47524761
}
47534762
TY_(InsertNodeAtEnd)( &doc->root, html);
47544763
TY_(ParseHTML)( doc, html, IgnoreWhitespace );

0 commit comments

Comments
 (0)