Issue #230: Need to KEEP this newline char sometimes.

This is a case where the lexer, in GetTokenfromStream, does NOT eat any
trailing newline after a LEX_STARTTAG: case...

So far have identified pre, script, style as NEEDING this user newline
character for later pprint output. Any others?
This commit is contained in:
Geoff McLane 2015-07-15 19:34:02 +02:00
parent cb2543efac
commit 4246c2c462

View file

@ -2624,6 +2624,15 @@ static Node* GetTokenFromStream( TidyDocImpl* doc, GetTokenMode mode )
/* special check needed for CRLF sequence */
/* this doesn't apply to empty elements */
/* nor to preformatted content that needs escaping */
/*\
* Issue #230: Need to KEEP this user newline character in certain
* circumstances, certainly for <pre>, <script>, <style>...
* Any others?
\*/
if ( nodeIsPRE(lexer->token) || nodeIsSCRIPT(lexer->token) || nodeIsSTYLE(lexer->token))
{
mode = Preformatted;
}
if ((mode != Preformatted && ExpectsContent(lexer->token))
|| nodeIsBR(lexer->token) || nodeIsHR(lexer->token))