MediaWiki master
MediaWiki\Parser\ParserCoreTagHooks Class Reference

Various tag hooks, registered in every Parser. More...

Public Member Functions

 __construct (private readonly ServiceOptions $svcOptions, private readonly LanguageFactory $languageFactory, private readonly LanguageConverterFactory $languageConverterFactory,)
 
 gallery (?string $content, array $attributes, Parser $parser)
 Core parser tag hook function for 'gallery'.
 
 html (?string $content, array $attributes, Parser $parser)
 Core parser tag hook function for 'html', used only when $wgRawHtml is enabled.
 
 indicator (?string $content, array $attributes, Parser $parser, PPFrame $frame)
 XML-style tag for page status indicators: icons (or short text snippets) usually displayed in the top-right corner of the page, outside of the main content.
 
 langconvert (?string $content, array $attributes, Parser $parser, PPFrame $frame)
 Returns content converted into the requested language variant, using LanguageConverter.
 
 nowiki (?string $content, array $attributes, Parser $parser)
 Core parser tag hook function for 'nowiki'.
 
 pre (?string $content, array $attribs, Parser $parser, PPFrame $frame)
 Core parser tag hook function for 'pre'.
 
 register (Parser $parser)
 

Public Attributes

const CONSTRUCTOR_OPTIONS
 

Detailed Description

Various tag hooks, registered in every Parser.

Since
1.46

Definition at line 26 of file ParserCoreTagHooks.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Parser\ParserCoreTagHooks::__construct ( private readonly ServiceOptions $svcOptions,
private readonly LanguageFactory $languageFactory,
private readonly LanguageConverterFactory $languageConverterFactory )
Access: internal

Definition at line 39 of file ParserCoreTagHooks.php.

Member Function Documentation

◆ gallery()

MediaWiki\Parser\ParserCoreTagHooks::gallery ( ?string $content,
array $attributes,
Parser $parser )

Core parser tag hook function for 'gallery'.

Renders a thumbnail list of the given images, with optional captions. Full syntax documented on the wiki:

https://www.mediawiki.org/wiki/Help:Images#Gallery_syntax

Todo
break Parser::renderImageGallery out here too.
Parameters
?string$content
array$attributes
Parser$parser
Returns
string HTML
Access: internal

Definition at line 189 of file ParserCoreTagHooks.php.

◆ html()

MediaWiki\Parser\ParserCoreTagHooks::html ( ?string $content,
array $attributes,
Parser $parser )

Core parser tag hook function for 'html', used only when $wgRawHtml is enabled.

This is potentially unsafe and should be used only in very careful circumstances, as the contents are emitted as raw HTML.

Uses undocumented extended tag hook return values, introduced in r61913.

Parameters
?string$content
array$attributes
Parser$parser
Returns
array|string Output of tag hook
Access: internal

Definition at line 122 of file ParserCoreTagHooks.php.

References MediaWiki\Parser\Parser\getOptions(), and MediaWiki\Parser\Parser\msg().

Referenced by MediaWiki\Parser\ParserCoreTagHooks\register().

◆ indicator()

MediaWiki\Parser\ParserCoreTagHooks::indicator ( ?string $content,
array $attributes,
Parser $parser,
PPFrame $frame )

XML-style tag for page status indicators: icons (or short text snippets) usually displayed in the top-right corner of the page, outside of the main content.

Used outside core by the CommunityRequests extension.

Parameters
?string$content
array$attributes
Parser$parser
PPFrame$frame
Returns
string

Definition at line 205 of file ParserCoreTagHooks.php.

References MediaWiki\Parser\Parser\msg().

◆ langconvert()

MediaWiki\Parser\ParserCoreTagHooks::langconvert ( ?string $content,
array $attributes,
Parser $parser,
PPFrame $frame )

Returns content converted into the requested language variant, using LanguageConverter.

Parameters
?string$content
array$attributes
Parser$parser
PPFrame$frame
Returns
array
Access: internal

Definition at line 230 of file ParserCoreTagHooks.php.

References MediaWiki\Parser\Parser\recursiveTagParse().

◆ nowiki()

MediaWiki\Parser\ParserCoreTagHooks::nowiki ( ?string $content,
array $attributes,
Parser $parser )

Core parser tag hook function for 'nowiki'.

Text within this section gets interpreted as a string of text with HTML-compatible character references, and wiki markup within it will not be expanded.

Uses undocumented extended tag hook return values, introduced in r61913.

Used outside core by the Scribunto extension.

Uses custom html escaping which phan-taint-check won't recognize hence we suppress the error.

Parameters
?string$content
array$attributes
Parser$parser
Returns
array

Definition at line 159 of file ParserCoreTagHooks.php.

◆ pre()

MediaWiki\Parser\ParserCoreTagHooks::pre ( ?string $content,
array $attribs,
Parser $parser,
PPFrame $frame )

Core parser tag hook function for 'pre'.

Text is treated roughly as 'nowiki' wrapped in an HTML 'pre' tag; valid HTML attributes are passed on.

Parameters
?string$content
array$attribs
Parser$parser
PPFrame$frame
Returns
string HTML
Access: internal

Definition at line 74 of file ParserCoreTagHooks.php.

References MediaWiki\Parser\Parser\recursiveTagParse().

◆ register()

MediaWiki\Parser\ParserCoreTagHooks::register ( Parser $parser)
Access: internal

Definition at line 50 of file ParserCoreTagHooks.php.

References MediaWiki\Parser\ParserCoreTagHooks\html().

Referenced by MediaWiki\Parser\Parser\__construct().

Member Data Documentation

◆ CONSTRUCTOR_OPTIONS

const MediaWiki\Parser\ParserCoreTagHooks::CONSTRUCTOR_OPTIONS
Initial value:
= [
]
const RawHtml
Name constant for the RawHtml setting, for use with Config::get()
Access: internal
For use by ServiceWiring

Definition at line 31 of file ParserCoreTagHooks.php.


The documentation for this class was generated from the following file: