TextContent: Normalize newlines in preSaveTransform()
authorBrad Jorsch <bjorsch@wikimedia.org>
Mon, 15 Aug 2016 15:26:44 +0000 (11:26 -0400)
committerBrad Jorsch <bjorsch@wikimedia.org>
Tue, 16 Aug 2016 14:21:32 +0000 (10:21 -0400)
commit96b6afb31dfcff463d1d56e0842c3faa093699cb
tree661d96f6bb65b0b8b6fb7f7ec463965392d7bbbd
parenta979689003acd0e2722b9abaca8d86a74f345ead
TextContent: Normalize newlines in preSaveTransform()

This does the same normalization of newlines that
Parser::preSaveTransform() does. This should be appropriate for any text
content type, especially considering that EditPage uses
WebRequest::getText() which does a less-strict version of this same
transformation.

This also cleans up the code for doing that newline replacement
to be a bit less verbose.

Bug: T142805
Change-Id: I462afcda502f031a8b0360d982ce2398a0383a96
includes/content/TextContent.php
includes/parser/Parser.php
tests/phpunit/includes/content/TextContentTest.php