Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -3647,7 +3647,8 @@ |
3648 | 3648 | $legacyAnchor .= '_' . $refers[$legacyArrayKey]; |
3649 | 3649 | } |
3650 | 3650 | if( $enoughToc && ( !isset($wgMaxTocLevel) || $toclevel<$wgMaxTocLevel ) ) { |
3651 | | - $toc .= $sk->tocLine($anchor, $tocline, $numbering, $toclevel); |
| 3651 | + $toc .= $sk->tocLine($anchor, $tocline, |
| 3652 | + $numbering, $toclevel, ($isTemplate ? false : $sectionIndex)); |
3652 | 3653 | |
3653 | 3654 | # Find the DOM node for this header |
3654 | 3655 | while ( $node && !$isTemplate ) { |
— | — | @@ -3703,6 +3704,8 @@ |
3704 | 3705 | } |
3705 | 3706 | $toc = $sk->tocList( $toc ); |
3706 | 3707 | } |
| 3708 | + |
| 3709 | + $this->mOutput->setTOCHTML( $toc ); |
3707 | 3710 | |
3708 | 3711 | # split up and insert constructed headlines |
3709 | 3712 | |
Index: trunk/phase3/includes/parser/ParserOutput.php |
— | — | @@ -24,7 +24,8 @@ |
25 | 25 | $mOutputHooks = array(), # Hook tags as per $wgParserOutputHooks |
26 | 26 | $mWarnings = array(), # Warning text to be returned to the user. Wikitext formatted, in the key only |
27 | 27 | $mSections = array(), # Table of contents |
28 | | - $mProperties = array(); # Name/value pairs to be cached in the DB |
| 28 | + $mProperties = array(), # Name/value pairs to be cached in the DB |
| 29 | + $mTOCHTML = ''; # HTML of the TOC |
29 | 30 | private $mIndexPolicy = ''; # 'index' or 'noindex'? Any other value will result in no change. |
30 | 31 | |
31 | 32 | /** |
— | — | @@ -58,6 +59,7 @@ |
59 | 60 | function getOutputHooks() { return (array)$this->mOutputHooks; } |
60 | 61 | function getWarnings() { return array_keys( $this->mWarnings ); } |
61 | 62 | function getIndexPolicy() { return $this->mIndexPolicy; } |
| 63 | + function getTOCHTML() { return $this->mTOCHTML; } |
62 | 64 | |
63 | 65 | function containsOldMagic() { return $this->mContainsOldMagic; } |
64 | 66 | function setText( $text ) { return wfSetVar( $this->mText, $text ); } |
— | — | @@ -68,6 +70,7 @@ |
69 | 71 | function setTitleText( $t ) { return wfSetVar( $this->mTitleText, $t ); } |
70 | 72 | function setSections( $toc ) { return wfSetVar( $this->mSections, $toc ); } |
71 | 73 | function setIndexPolicy( $policy ) { return wfSetVar( $this->mIndexPolicy, $policy ); } |
| 74 | + function setTOCHTML( $tochtml ) { return wfSetVar( $this->mTOCHTML, $tochtml ); } |
72 | 75 | |
73 | 76 | function addCategory( $c, $sort ) { $this->mCategories[$c] = $sort; } |
74 | 77 | function addLanguageLink( $t ) { $this->mLanguageLinks[] = $t; } |
Index: trunk/phase3/includes/Linker.php |
— | — | @@ -1142,8 +1142,11 @@ |
1143 | 1143 | /** |
1144 | 1144 | * parameter level defines if we are on an indentation level |
1145 | 1145 | */ |
1146 | | - function tocLine( $anchor, $tocline, $tocnumber, $level ) { |
1147 | | - return "\n<li class=\"toclevel-$level\"><a href=\"#" . |
| 1146 | + function tocLine( $anchor, $tocline, $tocnumber, $level, $sectionIndex = false ) { |
| 1147 | + $classes = "toclevel-$level"; |
| 1148 | + if ( $sectionIndex !== false ) |
| 1149 | + $classes .= " tocsection-$sectionIndex"; |
| 1150 | + return "\n<li class=\"$classes\"><a href=\"#" . |
1148 | 1151 | $anchor . '"><span class="tocnumber">' . |
1149 | 1152 | $tocnumber . '</span> <span class="toctext">' . |
1150 | 1153 | $tocline . '</span></a>'; |