/**
* parameter level defines if we are on an indentation level
*/
- function tocLine( $anchor, $tocline, $tocnumber, $level ) {
- return "\n<li class=\"toclevel-$level\"><a href=\"#" .
+ function tocLine( $anchor, $tocline, $tocnumber, $level, $sectionIndex = false ) {
+ $classes = "toclevel-$level";
+ if ( $sectionIndex !== false )
+ $classes .= " tocsection-$sectionIndex";
+ return "\n<li class=\"$classes\"><a href=\"#" .
$anchor . '"><span class="tocnumber">' .
$tocnumber . '</span> <span class="toctext">' .
$tocline . '</span></a>';
$legacyAnchor .= '_' . $refers[$legacyArrayKey];
}
if( $enoughToc && ( !isset($wgMaxTocLevel) || $toclevel<$wgMaxTocLevel ) ) {
- $toc .= $sk->tocLine($anchor, $tocline, $numbering, $toclevel);
+ $toc .= $sk->tocLine($anchor, $tocline,
+ $numbering, $toclevel, ($isTemplate ? false : $sectionIndex));
# Find the DOM node for this header
while ( $node && !$isTemplate ) {
}
$toc = $sk->tocList( $toc );
}
+
+ $this->mOutput->setTOCHTML( $toc );
# split up and insert constructed headlines
$mOutputHooks = array(), # Hook tags as per $wgParserOutputHooks
$mWarnings = array(), # Warning text to be returned to the user. Wikitext formatted, in the key only
$mSections = array(), # Table of contents
- $mProperties = array(); # Name/value pairs to be cached in the DB
+ $mProperties = array(), # Name/value pairs to be cached in the DB
+ $mTOCHTML = ''; # HTML of the TOC
private $mIndexPolicy = ''; # 'index' or 'noindex'? Any other value will result in no change.
/**
function getOutputHooks() { return (array)$this->mOutputHooks; }
function getWarnings() { return array_keys( $this->mWarnings ); }
function getIndexPolicy() { return $this->mIndexPolicy; }
+ function getTOCHTML() { return $this->mTOCHTML; }
function containsOldMagic() { return $this->mContainsOldMagic; }
function setText( $text ) { return wfSetVar( $this->mText, $text ); }
function setTitleText( $t ) { return wfSetVar( $this->mTitleText, $t ); }
function setSections( $toc ) { return wfSetVar( $this->mSections, $toc ); }
function setIndexPolicy( $policy ) { return wfSetVar( $this->mIndexPolicy, $policy ); }
+ function setTOCHTML( $tochtml ) { return wfSetVar( $this->mTOCHTML, $tochtml ); }
function addCategory( $c, $sort ) { $this->mCategories[$c] = $sort; }
function addLanguageLink( $t ) { $this->mLanguageLinks[] = $t; }