Handle some issues with misusing VERS_HTML5 in the doctype.

This commit is contained in:
Jim Derry 2016-02-12 20:49:14 +08:00
parent c81a151da5
commit e947d296e4

View file

@ -1748,7 +1748,7 @@ Bool TY_(SetXHTMLDocType)( TidyDocImpl* doc )
TY_(RepairAttrValue)(doc, doctype, sys, ""); TY_(RepairAttrValue)(doc, doctype, sys, "");
break; break;
case TidyDoctypeAuto: case TidyDoctypeAuto:
if (lexer->doctype == VERS_UNKNOWN) { if (lexer->doctype == VERS_UNKNOWN || lexer->doctype == VERS_HTML5) {
lexer->versionEmitted = XH50; lexer->versionEmitted = XH50;
return yes; return yes;
} }
@ -1828,7 +1828,8 @@ Bool TY_(FixDocType)( TidyDocImpl* doc )
if (doctype && (dtmode == TidyDoctypeAuto) && if (doctype && (dtmode == TidyDoctypeAuto) &&
(lexer->doctype == VERS_HTML5) ) (lexer->doctype == VERS_HTML5) )
{ {
lexer->versionEmitted = lexer->doctype; /* The version emitted cannot be a composite value! */
lexer->versionEmitted = HT50;
return yes; return yes;
} }
if (dtmode == TidyDoctypeAuto && if (dtmode == TidyDoctypeAuto &&