Issue #307, #167, #169 - regression of nestd anchors

This commit is contained in:
Geoff McLane 2015-11-22 18:46:00 +01:00
parent 496c81c48d
commit 2388fb0175
7 changed files with 42 additions and 8 deletions

View file

@ -100,7 +100,7 @@ static void Show_Node( TidyDocImpl* doc, const char *msg, Node *node )
int col = ( doc->lexer ? doc->lexer->columns : 0 ); int col = ( doc->lexer ? doc->lexer->columns : 0 );
SPRTF("R=%d C=%d: ", line, col ); SPRTF("R=%d C=%d: ", line, col );
// DEBUG: Be able to set a TRAP on a SPECIFIC row,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 check_me("Show_Node"); // just a debug trap
} }
if (lexer && lexer->token && if (lexer && lexer->token &&

View file

@ -1333,6 +1333,36 @@ void TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode)
} }
} }
/*\
* Issue #307 - an <A> tag to ends any open <A> 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 */ /* parse known element */
if (TY_(nodeIsElement)(node)) if (TY_(nodeIsElement)(node))
{ {

View file

@ -1,6 +1,8 @@
line 1 column 1 - Warning: missing <!DOCTYPE> declaration line 1 column 1 - Warning: missing <!DOCTYPE> declaration
line 6 column 1 - Warning: missing </a> before <a>
line 7 column 6 - Warning: discarding unexpected </a>
Info: Document content looks like HTML5 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 About HTML Tidy: https://github.com/htacg/tidy-html5
Bug reports and comments: https://github.com/htacg/tidy-html5/issues Bug reports and comments: https://github.com/htacg/tidy-html5/issues

View file

@ -1,6 +1,8 @@
line 1 column 1 - Warning: missing <!DOCTYPE> declaration line 1 column 1 - Warning: missing <!DOCTYPE> declaration
line 4 column 1 - Warning: missing </a> before <a>
line 4 column 74 - Warning: discarding unexpected </a>
Info: Document content looks like HTML5 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 About HTML Tidy: https://github.com/htacg/tidy-html5
Bug reports and comments: https://github.com/htacg/tidy-html5/issues Bug reports and comments: https://github.com/htacg/tidy-html5/issues

View file

@ -4,6 +4,6 @@
<title>[ #427827 ] Nested anchor elements allowed</title> <title>[ #427827 ] Nested anchor elements allowed</title>
</head> </head>
<body> <body>
<a href="1">link-1 <a href="2">link-2</a> plain</a> <a href="1">link-1</a> <a href="2">link-2</a> plain
</body> </body>
</html> </html>

View file

@ -5,7 +5,7 @@
</head> </head>
<body> <body>
<a name="top" <a name="top"
id="top"><a href="http://www.genuki.org.uk">Test for bug id="top"></a><a href="http://www.genuki.org.uk">Test for
#431874</a></a> bug #431874</a>
</body> </body>
</html> </html>

View file

@ -1,2 +1,2 @@
5.1.24 5.1.25
2015.11.18 2015.11.21