Issue #329 - lexer.c - do not discard this newline here

This commit is contained in:
Geoff McLane 2017-02-23 15:27:03 +01:00
parent 0bd6ba30b4
commit 569ae4b435
1 changed files with 3 additions and 1 deletions

View File

@ -2986,7 +2986,9 @@ static Node* GetTokenFromStream( TidyDocImpl* doc, GetTokenMode mode )
{
c = TY_(ReadChar)(doc->docIn);
if (c != '\n' && c != '\f')
if ((c == '\n') && (mode != IgnoreWhitespace)) /* Issue #329 - Can NOT afford to lose this newline */
TY_(UngetChar)(c, doc->docIn); /* Issue #329 - make sure the newline is maintained for now */
else if (c != '\n' && c != '\f')
TY_(UngetChar)(c, doc->docIn);
lexer->waswhite = yes; /* to swallow leading whitespace */