Apply content wrapping in ParserOutput::getText()
authordaniel <daniel.kinzler@wikimedia.de>
Tue, 28 Aug 2018 16:48:10 +0000 (18:48 +0200)
committerdaniel <daniel.kinzler@wikimedia.de>
Wed, 29 Aug 2018 14:46:25 +0000 (16:46 +0200)
commit0dc7ba02b4483700a2fc3ab6bf76a3dd072ef054
tree9261e907fa989df3fa9d9afc5fbcbb5a43e1e980
parent73380233aab4e2009acdbaa8d6ac928c499408af
Apply content wrapping in ParserOutput::getText()

Instead of applying wrapping the the parser and unwrapping in
ParserOutput::getText(), turn this around and apply wrapping in getText(),
and only if desired.

This avoids search&replace logic for unwrapping, and it also makes it a lot
easier to merge the output of multiple slots for MCR output.

This changes behavior in two hopefully irrelevant ways:
1) the limit report comments will be inside the wrapper div, instead of
following it.
2) if HTML with a wrapper div is explicitly injected into a ParserOutput
object, it will not be possible to unwrap the text.

Bug: T174035
Change-Id: I1641b7995af9bd297f1acd610d583fbf874f34e0
includes/api/ApiParse.php
includes/content/TextContent.php
includes/parser/Parser.php
includes/parser/ParserOutput.php
tests/phpunit/includes/api/ApiParseTest.php
tests/phpunit/includes/parser/ParserMethodsTest.php
tests/phpunit/includes/parser/ParserOutputTest.php