52 $samePage =
false, $wikiId =
false
54 return $this->formatInternal( $comment,
true,
false,
false,
55 $selfLinkTarget, $samePage, $wikiId );
73 $samePage =
false, $wikiId =
false, $useParentheses =
true
75 return $this->formatInternal( $comment,
true,
true, $useParentheses,
76 $selfLinkTarget, $samePage, $wikiId );
98 $samePage =
false, $wikiId =
false
100 $parser = $this->parserFactory->create();
102 $samePage, $wikiId,
false );
103 return $parser->
finalize( $preprocessed );
119 $samePage =
false, $wikiId =
false
121 return $this->formatInternal( $comment,
false,
false,
false,
122 $selfLinkTarget, $samePage, $wikiId );
140 private function formatInternal( $comment, $enableSectionLinks, $useBlock, $useParentheses,
141 $selfLinkTarget =
null, $samePage =
false, $wikiId =
false
143 $parser = $this->parserFactory->create();
144 $preprocessed = $parser->
preprocess( $comment, $selfLinkTarget, $samePage, $wikiId,
145 $enableSectionLinks );
146 $output = $parser->
finalize( $preprocessed );
169 $samePage =
false, $wikiId =
false
171 $parser = $this->parserFactory->create();
173 foreach ( $strings as $i => $comment ) {
174 $outputs[$i] = $parser->
preprocess( $comment, $selfLinkTarget, $samePage, $wikiId );
176 return $parser->
finalize( $outputs );
197 $samePage =
false, $wikiId =
false, $useParentheses =
true
199 $parser = $this->parserFactory->create();
201 foreach ( $strings as $i => $comment ) {
203 $parser->
preprocess( $comment, $selfLinkTarget, $samePage, $wikiId ),
206 return $parser->
finalize( $outputs );
233 $useParentheses =
true
235 $parser = $this->parserFactory->create();
236 return $parser->
finalize( $this->preprocessRevComment(
237 $parser, $authority, $revision, $samePage, $isPublic, $useParentheses ) );
258 $useParentheses =
true,
261 $parser = $this->parserFactory->create();
263 foreach ( $revisions as $i => $rev ) {
265 $key = $rev->getId();
270 $outputs[$key] = $this->preprocessRevComment(
271 $parser, $authority, $rev, $samePage, $isPublic, $useParentheses );
273 return $parser->
finalize( $outputs );
313 $samePage =
null, $wikiId =
null, $enableSectionLinks =
null,
314 $useBlock =
null, $useParentheses =
null
317 $parser = $this->parserFactory->create();
318 foreach ( $items as $index => $item ) {
321 $item->selfLinkTarget ?? $selfLinkTarget,
322 $item->samePage ?? $samePage ??
false,
323 $item->wikiId ?? $wikiId ??
false,
324 $enableSectionLinks ??
true
326 if ( $useBlock ??
false ) {
329 $useParentheses ??
true
332 $outputs[$index] = $preprocessed;
334 return $parser->
finalize( $outputs );
347 $formatted, $useParentheses
352 if ( $formatted ==
'' || $formatted ==
'*' ) {
355 if ( $useParentheses ) {
356 $formatted =
wfMessage(
'parentheses' )->rawParams( $formatted )->escaped();
357 $classNames =
'comment';
359 $classNames =
'comment comment--without-parentheses';
361 return " <span class=\"$classNames\">$formatted</span>";
375 private function preprocessRevComment(
381 $useParentheses =
true
383 if ( $revRecord->
getComment( RevisionRecord::RAW ) ===
null ) {
387 RevisionRecord::DELETED_COMMENT,
388 $isPublic ? RevisionRecord::FOR_PUBLIC : RevisionRecord::FOR_THIS_USER,
391 $comment = $revRecord->
getComment( RevisionRecord::FOR_THIS_USER, $authority );
393 $comment ? $comment->text :
'',
394 $revRecord->getPageAsLinkTarget(),
401 $block =
" <span class=\"comment\">" .
wfMessage(
'rev-deleted-comment' )->escaped() .
"</span>";
403 if ( $revRecord->
isDeleted( RevisionRecord::DELETED_COMMENT ) ) {
404 $class = Linker::getRevisionDeletedClass( $revRecord );
405 return " <span class=\"$class comment\">$block</span>";