18 parent::__construct( $text, CONTENT_MODEL_SCRIBUNTO );
29 $engine->setTitle(
$title );
59 $doc->exists() ?
'scribunto-doc-page-show' :
'scribunto-doc-page-does-not-exist',
60 $doc->getPrefixedText()
61 )->inContentLanguage();
63 if ( !$msg->isDisabled() ) {
66 $docViewLang = $doc->getPageViewLanguage();
67 $dir = $docViewLang->getDir();
73 $dirClass =
"mw-content-$dir";
75 $docWikitext = Html::rawElement(
78 'lang' => $docViewLang->getHtmlCode(),
84 "\n" . $msg->plain() .
"\n"
91 $output =
$wgParser->parse( $docWikitext,
$title, $options,
true,
true, $revId );
96 $output->
addTemplate( $doc, $doc->getArticleID(), $doc->getLatestRevID() );
101 $status = $this->
validate( $title );
102 if ( !$status->isOK() ) {
104 Html::rawElement(
'div', [
'class' =>
'errorbox' ],
105 $status->getHTML(
'scribunto-error-short',
'scribunto-error-long' )
111 if ( !$generateHtml ) {
118 $engine->setTitle(
$title );
119 if ( $this->
highlight( $text, $output, $engine ) ) {
125 "<pre class='mw-code mw-script' dir='ltr'>\n" .
126 htmlspecialchars( $text ) .
141 global $wgScribuntoUseGeSHi;
143 if ( $wgScribuntoUseGeSHi && class_exists( SyntaxHighlight::class ) && $language ) {
145 if ( $status->isGood() ) {
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
Set options of the Parser.
getTargetLanguage()
Target language for the parse.
setTargetLanguage( $x)
Target language for the parse.
addTrackingCategory( $msg, $title)
Add a tracking category, getting the title from a system message, or print a debug message if the tit...
addTemplate( $title, $page_id, $rev_id)
Register a template dependency for this output.
getRawText()
Get the cacheable text with <mw:editsection> markers still in it.
addModuleStyles( $modules)
Represents the content of a Scribunto script page.
highlight( $text, ParserOutput $output, ScribuntoEngineBase $engine)
Adds syntax highlighting to the output (or do not touch it and return false).
validate(Title $title)
Checks whether the script is valid.
fillParserOutput(Title $title, $revId, ParserOptions $options, $generateHtml, ParserOutput &$output)
Parse the Content object and generate a ParserOutput from the result.
prepareSave(WikiPage $page, $flags, $parentRevId, User $user)
Wikitext scripting infrastructure for MediaWiki: base classes.
getGeSHiLanguage()
Get the language for GeSHi syntax highlighter.
static newDefaultEngine( $extraOptions=[])
Create a new engine object with default parameters.
static getDocPage(Title $title)
Return the Title for the documentation page.
static highlight( $code, $lang=null, $args=[])
Highlight a code-block using a particular lexer.
Content object implementation for representing flat text.
getText()
Returns the text represented by this Content object, as a string.
Represents a title within MediaWiki.
getPrefixedDBkey()
Get the prefixed database key form.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Class representing a MediaWiki article and history.
getTitle()
Get the title object of the article.