Merge pull request #368 from htacg/issue-341

Issue #341
This commit is contained in:
Jim Derry 2016-02-16 10:18:26 +08:00
commit 1e4f7dd0f1
3 changed files with 17 additions and 7 deletions

View File

@ -10,6 +10,9 @@
#include "attrs.h"
#include "streamio.h"
#include "tmbstr.h"
#if !defined(NDEBUG) && defined(_MSC_VER)
#include "sprtf.h"
#endif
/* duplicate attributes */
AttVal *TY_(DupAttrs)( TidyDocImpl* doc, AttVal *attrs)
@ -115,6 +118,7 @@ static void PopIStack( TidyDocImpl* doc )
TY_(FreeAttribute)( doc, av );
}
TidyDocFree(doc, istack->element);
istack->element = NULL; /* remove the freed element */
}
static void PopIStackUntil( TidyDocImpl* doc, TidyTagId tid )
@ -267,9 +271,12 @@ Node *TY_(InsertedToken)( TidyDocImpl* doc )
node->end = lexer->txtend; /* was : lexer->txtstart; */
istack = lexer->insert;
#if 0 && defined(_DEBUG)
/* #if 0 && defined(_DEBUG) */
#if !defined(NDEBUG) && defined(_MSC_VER)
if ( lexer->istacksize == 0 )
fprintf( stderr, "0-size istack!\n" );
{
SPRTF( "WARNING: ZERO sized istack!\n" );
}
#endif
node->element = TY_(tmbstrdup)(doc->allocator, istack->element);

View File

@ -144,7 +144,7 @@ static void Show_Node( TidyDocImpl* doc, const char *msg, Node *node )
tmbstr src = lex ? "lexer" : "stream";
SPRTF("R=%d C=%d: ", line, col );
// DEBUG: Be able to set a TRAP on a SPECIFIC row,col
if ((line == 8) && (col == 36)) {
if ((line == 67) && (col == 95)) {
check_me("Show_Node"); // just a debug trap
}
if (lexer && lexer->token &&
@ -2307,8 +2307,11 @@ Node* TY_(GetToken)( TidyDocImpl* doc, GetTokenMode mode )
assert( !(lexer->pushed || lexer->itoken) );
/* at start of block elements, unclosed inline
elements are inserted into the token stream */
if (lexer->insert || lexer->inode) {
elements are inserted into the token stream
Issue #341 - Can NOT insert a token if NO istacksize
*/
if ((lexer->insert || lexer->inode) && lexer->istacksize)
{
/*\ Issue #92: could fix by the following, but instead chose not to stack these 2
* if ( !(lexer->insert && (nodeIsINS(lexer->insert) || nodeIsDEL(lexer->insert))) ) {
\*/

View File

@ -1,2 +1,2 @@
5.1.36
2016.02.01
5.1.37Test
2016.02.08