From c0cad3aeba44da022662e781660a9fad787211b5 Mon Sep 17 00:00:00 2001 From: Geoff McLane Date: Fri, 6 Mar 2015 19:13:06 +0100 Subject: [PATCH] Issue #167 - further fixes for HTML5 mode --- src/lexer.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/lexer.c b/src/lexer.c index 6559814..ad6a876 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -166,6 +166,8 @@ int TY_(HTMLVersion)(TidyDocImpl* doc) if (xhtml && dtver == VERS_UNKNOWN) return XH50; if (dtver == VERS_UNKNOWN) return HT50; + /* Issue #167 - if NOT XHTML, and doctype is default VERS_HTML5, then return HT50 */ + if (!xhtml && (dtver == VERS_HTML5)) return HT50; for (i = 0; W3C_Doctypes[i].name; ++i) { @@ -1747,6 +1749,13 @@ Bool TY_(FixDocType)( TidyDocImpl* doc ) uint guessed = VERS_UNKNOWN; Bool hadSI = no; + /* Issue #167 - found doctype, and doctype is default VERS_HTML5, set VERS_HTML5 and return yes */ + if (doctype && (dtmode == TidyDoctypeAuto) && + (lexer->doctype == VERS_HTML5) ) + { + lexer->versionEmitted = lexer->doctype; + return yes; + } if (dtmode == TidyDoctypeAuto && lexer->versions & lexer->doctype && !(VERS_XHTML & lexer->doctype && !lexer->isvoyager)