*
* @return string
*/
- public static function formatLinksInComment( $comment, $title = null, $local = false, $wikiId = null ) {
+ public static function formatLinksInComment(
+ $comment, $title = null, $local = false, $wikiId = null
+ ) {
return preg_replace_callback(
'/
\[\[
* Currently unused.
*
* @param array $tree Return value of ParserOutput::getSections()
+ * @param string|Language|bool $lang Language for the toc title, defaults to user language
* @return string HTML fragment
*/
- public static function generateTOC( $tree ) {
+ public static function generateTOC( $tree, $lang = false ) {
$toc = '';
$lastLevel = 0;
foreach ( $tree as $section ) {
$lastLevel = $section['toclevel'];
}
$toc .= self::tocLineEnd();
- return self::tocList( $toc );
+ return self::tocList( $toc, $lang );
}
/**
$link, $legacyAnchor = false
) {
$ret = "<h$level$attribs"
- . Html::element( 'a',
- array(
- 'href' => '#' . $anchor,
- 'class' => 'mw-headline-anchor',
- // Hide from screen readers, as it is inside a heading (the programs use headings to
- // navigate, so the symbol is being read during navigation). Pending T13555 being fixed.
- 'aria-hidden' => 'true',
- 'title' => wfMessage( 'headline-anchor-title' )->text()
- ),
- wfMessage( 'section-symbol' )->text()
- )
. "<span class=\"mw-headline\" id=\"$anchor\">$html</span>"
. $link
. "</h$level>";