33 public static function register( $parser ) {
35 $parser->setHook(
'pre', [ __CLASS__,
'pre' ] );
36 $parser->setHook(
'nowiki', [ __CLASS__,
'nowiki' ] );
37 $parser->setHook(
'gallery', [ __CLASS__,
'gallery' ] );
38 $parser->setHook(
'indicator', [ __CLASS__,
'indicator' ] );
40 $parser->setHook(
'html', [ __CLASS__,
'html' ] );
58 public static function pre( $text, $attribs, $parser ) {
62 $attribs = Sanitizer::validateTagAttributes( $attribs,
'pre' );
70 return Html::rawElement(
'pre', $attribs,
$content );
92 if ( $parser->getOptions()->getAllowUnsafeRawHtml() ) {
93 return [
$content,
'markerType' =>
'nowiki' ];
98 return Html::rawElement(
100 [
'class' =>
'error' ],
103 wfMessage(
'rawhtml-notallowed' )->escaped()
107 throw new MWException(
'<html> extension tag encountered unexpectedly' );
138 return [
$content,
'markerType' =>
'nowiki' ];
157 return $parser->renderImageGallery(
$content, $attributes );
172 if ( !isset( $attributes[
'name'] ) || trim( $attributes[
'name'] ) ===
'' ) {
173 return '<span class="error">' .
174 wfMessage(
'invalid-indicator-name' )->inContentLanguage()->parse() .
179 trim( $attributes[
'name'] ),
$wgRawHtml
Allow raw, unchecked HTML in "<html>...</html>" sections.
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
Various tag hooks, registered in Parser::firstCallInit()
static pre( $text, $attribs, $parser)
Core parser tag hook function for 'pre'.
static indicator( $content, array $attributes, Parser $parser, PPFrame $frame)
XML-style tag for page status indicators: icons (or short text snippets) usually displayed in the top...
static gallery( $content, $attributes, $parser)
Core parser tag hook function for 'gallery'.
static nowiki( $content, $attributes, $parser)
Core parser tag hook function for 'nowiki'.
static html( $content, $attributes, $parser)
Core parser tag hook function for 'html', used only when $wgRawHtml is enabled.
PHP Parser - Processes wiki markup (which uses a more user-friendly syntax, such as "[[link]]" for ma...
recursiveTagParseFully( $text, $frame=false)
Fully parse wikitext to fully parsed HTML.
static delimiterReplace( $startDelim, $endDelim, $replace, $subject, $flags='')
Perform an operation equivalent to preg_replace() with flags.