(DAT-4494) Don't perform replacements on JSON encoded content

This commit is contained in:
grunny 2016-06-16 17:39:06 +00:00
parent 8186618eb9
commit 899b127b00

View file

@ -144,7 +144,17 @@ class PortableInfoboxParserTagController extends WikiaController {
} }
public function replaceMarkers( $text ) { public function replaceMarkers( $text ) {
return strtr( $text, $this->markers ); global $wgArticleAsJson;
if ( $wgArticleAsJson ) {
$contentArray = json_decode( $text, true );
$text = $contentArray['content'];
}
$text = strtr( $text, $this->markers );
if ( $wgArticleAsJson ) {
$contentArray['content'] = $text;
$text = json_encode( $contentArray );
}
return $text;
} }
protected function saveToParserOutput( \ParserOutput $parserOutput, Nodes\NodeInfobox $raw ) { protected function saveToParserOutput( \ParserOutput $parserOutput, Nodes\NodeInfobox $raw ) {