Issue #153 - fix for endif section no conforming to what tidy expects
This commit is contained in:
parent
66951a562a
commit
2172a498f6
38
src/lexer.c
38
src/lexer.c
|
@ -2171,7 +2171,7 @@ static void check_me(char *name)
|
||||||
static Node* GetTokenFromStream( TidyDocImpl* doc, GetTokenMode mode )
|
static Node* GetTokenFromStream( TidyDocImpl* doc, GetTokenMode mode )
|
||||||
{
|
{
|
||||||
Lexer* lexer = doc->lexer;
|
Lexer* lexer = doc->lexer;
|
||||||
uint c, badcomment = 0;
|
uint c, lexdump, badcomment = 0;
|
||||||
Bool isempty = no;
|
Bool isempty = no;
|
||||||
AttVal *attributes = NULL;
|
AttVal *attributes = NULL;
|
||||||
Node *node;
|
Node *node;
|
||||||
|
@ -2925,13 +2925,43 @@ static Node* GetTokenFromStream( TidyDocImpl* doc, GetTokenMode mode )
|
||||||
/* now look for '>' */
|
/* now look for '>' */
|
||||||
c = TY_(ReadChar)(doc->docIn);
|
c = TY_(ReadChar)(doc->docIn);
|
||||||
|
|
||||||
|
lexdump = 1;
|
||||||
if (c != '>')
|
if (c != '>')
|
||||||
{
|
{
|
||||||
TY_(UngetChar)(c, doc->docIn);
|
/* Issue #153 - can also be ]'-->' */
|
||||||
continue;
|
if (c == '-')
|
||||||
|
{
|
||||||
|
c = TY_(ReadChar)(doc->docIn);
|
||||||
|
if (c == '-')
|
||||||
|
{
|
||||||
|
c = TY_(ReadChar)(doc->docIn);
|
||||||
|
if (c != '>')
|
||||||
|
{
|
||||||
|
TY_(UngetChar)(c, doc->docIn);
|
||||||
|
TY_(UngetChar)('-', doc->docIn);
|
||||||
|
TY_(UngetChar)('-', doc->docIn);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
/* this failed!
|
||||||
|
TY_(AddCharToLexer)(lexer, '-'); TY_(AddCharToLexer)(lexer, '-'); lexdump = 0;
|
||||||
|
got output <![endif]--]> - needs furhter fix in pprint section output
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TY_(UngetChar)(c, doc->docIn);
|
||||||
|
TY_(UngetChar)('-', doc->docIn);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TY_(UngetChar)(c, doc->docIn);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lexer->lexsize -= 1;
|
lexer->lexsize -= lexdump;
|
||||||
lexer->txtend = lexer->lexsize;
|
lexer->txtend = lexer->lexsize;
|
||||||
lexer->lexbuf[lexer->lexsize] = '\0';
|
lexer->lexbuf[lexer->lexsize] = '\0';
|
||||||
lexer->state = LEX_CONTENT;
|
lexer->state = LEX_CONTENT;
|
||||||
|
|
Loading…
Reference in a new issue