MediaWiki REL1_39
MediaWiki\CommentFormatter\CommentParser Class Reference

The text processing backend for CommentFormatter. More...

Public Member Functions

 __construct (LinkRenderer $linkRenderer, LinkBatchFactory $linkBatchFactory, LinkCache $linkCache, RepoGroup $repoGroup, Language $userLang, Language $contLang, TitleParser $titleParser, NamespaceInfo $namespaceInfo, HookContainer $hookContainer)
 
 finalize ( $comments)
 Execute pending batch queries and replace markers in the specified string(s) with actual links.
 
 preprocess (string $comment, LinkTarget $selfLinkTarget=null, $samePage=false, $wikiId=false, $enableSectionLinks=true)
 Convert a comment to HTML, but replace links with markers which are resolved later.
 
 preprocessUnsafe ( $comment, LinkTarget $selfLinkTarget=null, $samePage=false, $wikiId=false, $enableSectionLinks=true)
 Convert a comment in pseudo-HTML format to HTML, replacing links with markers.
 

Detailed Description

The text processing backend for CommentFormatter.

CommentParser objects should be discarded after the comment batch is complete, in order to reduce memory usage.

Access: internal

Definition at line 32 of file CommentParser.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\CommentFormatter\CommentParser::__construct ( LinkRenderer $linkRenderer,
LinkBatchFactory $linkBatchFactory,
LinkCache $linkCache,
RepoGroup $repoGroup,
Language $userLang,
Language $contLang,
TitleParser $titleParser,
NamespaceInfo $namespaceInfo,
HookContainer $hookContainer )
Parameters
LinkRenderer$linkRenderer
LinkBatchFactory$linkBatchFactory
LinkCache$linkCache
RepoGroup$repoGroup
Language$userLang
Language$contLang
TitleParser$titleParser
NamespaceInfo$namespaceInfo
HookContainer$hookContainer

Definition at line 78 of file CommentParser.php.

Member Function Documentation

◆ finalize()

MediaWiki\CommentFormatter\CommentParser::finalize ( $comments)

Execute pending batch queries and replace markers in the specified string(s) with actual links.

Parameters
string | string[]$comments
Returns
string|string[]

Definition at line 142 of file CommentParser.php.

◆ preprocess()

MediaWiki\CommentFormatter\CommentParser::preprocess ( string $comment,
LinkTarget $selfLinkTarget = null,
$samePage = false,
$wikiId = false,
$enableSectionLinks = true )

Convert a comment to HTML, but replace links with markers which are resolved later.

Parameters
string$comment
LinkTarget | null$selfLinkTarget
bool$samePage
string | false | null$wikiId
bool$enableSectionLinks
Returns
string

Definition at line 111 of file CommentParser.php.

◆ preprocessUnsafe()

MediaWiki\CommentFormatter\CommentParser::preprocessUnsafe ( $comment,
LinkTarget $selfLinkTarget = null,
$samePage = false,
$wikiId = false,
$enableSectionLinks = true )

Convert a comment in pseudo-HTML format to HTML, replacing links with markers.

Parameters
string$comment
LinkTarget | null$selfLinkTarget
bool$samePage
string | false | null$wikiId
bool$enableSectionLinks
Returns
string

Definition at line 128 of file CommentParser.php.


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