mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Scribunto
synced 2024-09-23 10:22:54 +00:00
Use ParserOutput::getRawText() where available
This is unlikely to be a cause of the cache corruption since this isn't calling setText() on any wikitext ParserOutputs, but let's fix it just in case. Bug: T124356 Change-Id: Ic34c654af86385dede843009d89df6f442ddc915
This commit is contained in:
parent
581ca1111f
commit
dd0c6e7668
|
@ -91,7 +91,7 @@ class ScribuntoContent extends TextContent {
|
||||||
$engine->setTitle( $title );
|
$engine->setTitle( $title );
|
||||||
$status = $engine->validate( $text, $title->getPrefixedDBkey() );
|
$status = $engine->validate( $text, $title->getPrefixedDBkey() );
|
||||||
if ( !$status->isOK() ) {
|
if ( !$status->isOK() ) {
|
||||||
$output->setText( $output->getText() .
|
$output->setText( self::getPOText( $output ) .
|
||||||
Html::rawElement( 'div', array( 'class' => 'errorbox' ),
|
Html::rawElement( 'div', array( 'class' => 'errorbox' ),
|
||||||
$status->getHTML( 'scribunto-error-short', 'scribunto-error-long' )
|
$status->getHTML( 'scribunto-error-short', 'scribunto-error-long' )
|
||||||
)
|
)
|
||||||
|
@ -138,14 +138,14 @@ class ScribuntoContent extends TextContent {
|
||||||
if ( $wgUseSiteCss ) {
|
if ( $wgUseSiteCss ) {
|
||||||
$output->addModuleStyles( 'ext.geshi.local' );
|
$output->addModuleStyles( 'ext.geshi.local' );
|
||||||
}
|
}
|
||||||
$output->setText( $output->getText() . $code );
|
$output->setText( self::getPOText( $output ) . $code );
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// No GeSHi, or GeSHi can't parse it, use plain <pre>
|
// No GeSHi, or GeSHi can't parse it, use plain <pre>
|
||||||
$output->setText( $output->getText() .
|
$output->setText( self::getPOText( $output ) .
|
||||||
"<pre class='mw-code mw-script' dir='ltr'>\n" .
|
"<pre class='mw-code mw-script' dir='ltr'>\n" .
|
||||||
htmlspecialchars( $text ) .
|
htmlspecialchars( $text ) .
|
||||||
"\n</pre>\n"
|
"\n</pre>\n"
|
||||||
|
@ -154,6 +154,19 @@ class ScribuntoContent extends TextContent {
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetch the text from a ParserOutput
|
||||||
|
* @todo Once support for MW without ParserOutput::getRawText() is dropped,
|
||||||
|
* inline this.
|
||||||
|
* @param ParserOutput $po
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private static function getPOText( ParserOutput $po ) {
|
||||||
|
return is_callable( array( $po, 'getRawText' ) )
|
||||||
|
? $po->getRawText()
|
||||||
|
: $po->getText();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a Content object with pre-save transformations applied (or this
|
* Returns a Content object with pre-save transformations applied (or this
|
||||||
* object if no transformations apply).
|
* object if no transformations apply).
|
||||||
|
|
Loading…
Reference in a new issue