Issue #643 - Fix HTMLVersion function back to what it was!

This commit is contained in:
Geoff McLane 2017-11-17 14:47:24 +01:00
parent a820ff5897
commit cea9a465f3

View file

@ -236,6 +236,14 @@ static struct _doctypes
{ 0, 0, 0, no, NULL, NULL, NULL } { 0, 0, 0, no, NULL, NULL, NULL }
}; };
/*
* Issue #643 - Since VERS_FROM40 was extended to include VERS_HTML5
* to be used in the expanded entity table some 155 times,
* need a special macro here to denote just HTML 4 plus XHTML,
* which is actually the former define of VERS_FROM40
*/
#define VERS_HMTL40PX (VERS_HTML40|VERS_XHTML11|VERS_BASIC)
int TY_(HTMLVersion)(TidyDocImpl* doc) int TY_(HTMLVersion)(TidyDocImpl* doc)
{ {
uint i; uint i;
@ -247,7 +255,7 @@ int TY_(HTMLVersion)(TidyDocImpl* doc)
Bool xhtml = (cfgBool(doc, TidyXmlOut) || doc->lexer->isvoyager) && Bool xhtml = (cfgBool(doc, TidyXmlOut) || doc->lexer->isvoyager) &&
!cfgBool(doc, TidyHtmlOut); !cfgBool(doc, TidyHtmlOut);
Bool html4 = ((dtmode == TidyDoctypeStrict) || (dtmode == TidyDoctypeLoose) || Bool html4 = ((dtmode == TidyDoctypeStrict) || (dtmode == TidyDoctypeLoose) ||
(VERS_FROM40 & dtver) ? yes : no); (VERS_HMTL40PX & dtver) ? yes : no);
Bool html5 = (!html4 && ((dtmode == TidyDoctypeAuto) || Bool html5 = (!html4 && ((dtmode == TidyDoctypeAuto) ||
(dtmode == TidyDoctypeHtml5)) ? yes : no); (dtmode == TidyDoctypeHtml5)) ? yes : no);
@ -262,7 +270,7 @@ int TY_(HTMLVersion)(TidyDocImpl* doc)
for (i = 0; W3C_Doctypes[i].name; ++i) for (i = 0; W3C_Doctypes[i].name; ++i)
{ {
if ((xhtml && !(VERS_XHTML & W3C_Doctypes[i].vers)) || if ((xhtml && !(VERS_XHTML & W3C_Doctypes[i].vers)) ||
(html4 && !(VERS_FROM40 & W3C_Doctypes[i].vers))) (html4 && !(VERS_HMTL40PX & W3C_Doctypes[i].vers)))
continue; continue;
if (vers & W3C_Doctypes[i].vers && if (vers & W3C_Doctypes[i].vers &&