*/ /** * Represents the content of a Scribunto script page */ class ScribuntoContent extends TextContent { function __construct( $text ) { parent::__construct( $text, 'Scribunto' ); } /** * Parse the Content object and generate a ParserOutput from the result. * * @param $title Title The page title to use as a context for rendering * @param $revId null|int The revision being rendered (optional) * @param $options null|ParserOptions Any parser options * @param $generateHtml boolean Whether to generate HTML (default: true). * @return ParserOutput */ public function getParserOutput( Title $title, $revId = null, ParserOptions $options = null, $generateHtml = true ) { global $wgParser, $wgScribuntoUseGeSHi; $text = $this->getNativeData(); $output = null; // Get documentation, if any $output = new ParserOutput(); $doc = Scribunto::getDocPage( $title ); if ( $doc ) { $msg = wfMessage( $doc->exists() ? 'scribunto-doc-page-show' : 'scribunto-doc-page-does-not-exist', $doc->getPrefixedText() )->inContentLanguage(); if ( !$msg->isDisabled() ) { // We need the ParserOutput for categories and such, so we // can't use $msg->parse(). $docViewLang = $doc->getPageViewLanguage(); $docWikitext = '
$output->setText( $output->getText() . "\n" . htmlspecialchars( $text ) . "\n\n" ); return $output; } /** * Returns a Content object with pre-save transformations applied (or this * object if no transformations apply). * * @param $title Title * @param $user User * @param $parserOptions null|ParserOptions * @return Content */ public function preSaveTransform( Title $title, User $user, ParserOptions $parserOptions ) { return $this; } }