diff --git a/src/lexer.c b/src/lexer.c index 32d93d7..909211c 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -100,7 +100,7 @@ static void Show_Node( TidyDocImpl* doc, const char *msg, Node *node ) int col = ( doc->lexer ? doc->lexer->columns : 0 ); SPRTF("R=%d C=%d: ", line, col ); // DEBUG: Be able to set a TRAP on a SPECIFIC row,col - if ((line == 9) && (col == 5)) { + if ((line == 8) && (col == 36)) { check_me("Show_Node"); // just a debug trap } if (lexer && lexer->token && diff --git a/src/parser.c b/src/parser.c index 209a8b3..17da766 100644 --- a/src/parser.c +++ b/src/parser.c @@ -1333,6 +1333,36 @@ void TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode) } } + /*\ + * Issue #307 - an tag to ends any open element + * Like #427827 - fixed by Randy Waki and Bjoern Hoehrmann 23 Aug 00 + * in ParseInline(), fix copied HERE to ParseBlock() + \*/ + if ( nodeIsA(node) && !node->implicit && + (nodeIsA(element) || DescendantOf(element, TidyTag_A)) ) + { + if (node->type != EndTag && node->attributes == NULL + && cfgBool(doc, TidyCoerceEndTags) ) + { + node->type = EndTag; + TY_(ReportError)(doc, element, node, COERCE_TO_ENDTAG); + TY_(UngetToken)( doc ); + continue; + } + + TY_(UngetToken)( doc ); + TY_(ReportError)(doc, element, node, MISSING_ENDTAG_BEFORE); + + if (!(mode & Preformatted)) + TrimSpaces(doc, element); + +#if !defined(NDEBUG) && defined(_MSC_VER) + in_parse_block--; + SPRTF("Exit ParseBlock 9b %d...\n",in_parse_block); +#endif + return; + } + /* parse known element */ if (TY_(nodeIsElement)(node)) { diff --git a/test/testbase/msg_427827.txt b/test/testbase/msg_427827.txt index e195281..7afae52 100644 --- a/test/testbase/msg_427827.txt +++ b/test/testbase/msg_427827.txt @@ -1,6 +1,8 @@ line 1 column 1 - Warning: missing declaration +line 6 column 1 - Warning: missing before +line 7 column 6 - Warning: discarding unexpected Info: Document content looks like HTML5 -1 warning, 0 errors were found! +3 warnings, 0 errors were found! About HTML Tidy: https://github.com/htacg/tidy-html5 Bug reports and comments: https://github.com/htacg/tidy-html5/issues diff --git a/test/testbase/msg_431874.txt b/test/testbase/msg_431874.txt index e195281..49071e5 100644 --- a/test/testbase/msg_431874.txt +++ b/test/testbase/msg_431874.txt @@ -1,6 +1,8 @@ line 1 column 1 - Warning: missing declaration +line 4 column 1 - Warning: missing before +line 4 column 74 - Warning: discarding unexpected Info: Document content looks like HTML5 -1 warning, 0 errors were found! +3 warnings, 0 errors were found! About HTML Tidy: https://github.com/htacg/tidy-html5 Bug reports and comments: https://github.com/htacg/tidy-html5/issues diff --git a/test/testbase/out_427827.html b/test/testbase/out_427827.html index 27a86c9..795cb9f 100644 --- a/test/testbase/out_427827.html +++ b/test/testbase/out_427827.html @@ -4,6 +4,6 @@ [ #427827 ] Nested anchor elements allowed - link-1 link-2 plain + link-1 link-2 plain diff --git a/test/testbase/out_431874.html b/test/testbase/out_431874.html index b9d2f62..5682a4e 100644 --- a/test/testbase/out_431874.html +++ b/test/testbase/out_431874.html @@ -5,7 +5,7 @@ Test for bug - #431874 + id="top">Test for + bug #431874 diff --git a/version.txt b/version.txt index 1428844..f4e550d 100644 --- a/version.txt +++ b/version.txt @@ -1,2 +1,2 @@ -5.1.24 -2015.11.18 +5.1.25 +2015.11.21