Newlines should be collapsed to single space.

Currently a single newline is completely removed if whitespace collapsing is enabled. This is not correct. It is treated as whitespace by browsers and should be collapsed to a single space.

Pull request includes fix and test case.