From cea9a465f394192f6d9b8c9c7096a6b761645133 Mon Sep 17 00:00:00 2001 From: Geoff McLane Date: Fri, 17 Nov 2017 14:47:24 +0100 Subject: [PATCH] Issue #643 - Fix HTMLVersion function back to what it was! --- src/lexer.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/lexer.c b/src/lexer.c index 56795cf..857017b 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -236,6 +236,14 @@ static struct _doctypes { 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) { uint i; @@ -247,7 +255,7 @@ int TY_(HTMLVersion)(TidyDocImpl* doc) Bool xhtml = (cfgBool(doc, TidyXmlOut) || doc->lexer->isvoyager) && !cfgBool(doc, TidyHtmlOut); Bool html4 = ((dtmode == TidyDoctypeStrict) || (dtmode == TidyDoctypeLoose) || - (VERS_FROM40 & dtver) ? yes : no); + (VERS_HMTL40PX & dtver) ? yes : no); Bool html5 = (!html4 && ((dtmode == TidyDoctypeAuto) || (dtmode == TidyDoctypeHtml5)) ? yes : no); @@ -262,7 +270,7 @@ int TY_(HTMLVersion)(TidyDocImpl* doc) for (i = 0; W3C_Doctypes[i].name; ++i) { if ((xhtml && !(VERS_XHTML & W3C_Doctypes[i].vers)) || - (html4 && !(VERS_FROM40 & W3C_Doctypes[i].vers))) + (html4 && !(VERS_HMTL40PX & W3C_Doctypes[i].vers))) continue; if (vers & W3C_Doctypes[i].vers &&