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 );
203 $useParentheses =
true
205 $parser = $this->parserFactory->create();
206 return $parser->
finalize( $this->preprocessRevComment(
207 $parser, $authority, $revision, $samePage, $isPublic, $useParentheses ) );
228 $useParentheses =
true,
231 $parser = $this->parserFactory->create();
233 foreach ( $revisions as $i => $rev ) {
235 $key = $rev->getId();
240 $outputs[$key] = $this->preprocessRevComment(
241 $parser, $authority, $rev, $samePage, $isPublic, $useParentheses );
243 return $parser->
finalize( $outputs );
283 $samePage =
null, $wikiId =
null, $enableSectionLinks =
null,
284 $useBlock =
null, $useParentheses =
null
287 $parser = $this->parserFactory->create();
288 foreach ( $items as $index => $item ) {
291 $item->selfLinkTarget ?? $selfLinkTarget,
292 $item->samePage ?? $samePage ??
false,
293 $item->wikiId ?? $wikiId ??
false,
294 $enableSectionLinks ??
true
296 if ( $useBlock ??
false ) {
299 $useParentheses ??
true
302 $outputs[$index] = $preprocessed;
304 return $parser->
finalize( $outputs );
317 $formatted, $useParentheses
322 if ( $formatted ==
'' || $formatted ==
'*' ) {
325 if ( $useParentheses ) {
326 $formatted =
wfMessage(
'parentheses' )->rawParams( $formatted )->escaped();
327 $classNames =
'comment';
329 $classNames =
'comment comment--without-parentheses';
331 return " <span class=\"$classNames\">$formatted</span>";
345 private function preprocessRevComment(
351 $useParentheses =
true
353 if ( $revRecord->
getComment( RevisionRecord::RAW ) ===
null ) {
357 RevisionRecord::DELETED_COMMENT,
358 $isPublic ? RevisionRecord::FOR_PUBLIC : RevisionRecord::FOR_THIS_USER,
361 $comment = $revRecord->
getComment( RevisionRecord::FOR_THIS_USER, $authority );
363 $comment ? $comment->text :
'',
364 $revRecord->getPageAsLinkTarget(),
371 $block =
" <span class=\"comment\">" .
wfMessage(
'rev-deleted-comment' )->escaped() .
"</span>";
373 if ( $revRecord->
isDeleted( RevisionRecord::DELETED_COMMENT ) ) {
374 $class = Linker::getRevisionDeletedClass( $revRecord );
375 return " <span class=\"$class comment\">$block</span>";