Extension:DeToc

Category:Unmaintained extensions#DeToc Category:Extensions without an imageCategory:GPL licensed extensions
MediaWiki extensions manual
DeToc
Release status: unmaintainedCategory:Unmaintained extensions
Implementation MyWiki Category:Personalization extensions
Description Extracts and removes the table of contents from the page
Author(s) Marcin Cieślak, contracted by Viato GmbH (sapertalk)
Latest version 1.0.0 (2015-10-16)
Compatibility policy Master maintains backward compatibility.Category:Extensions with master compatibility policy
MediaWiki 1.25+Category:Extensions with manual MediaWiki version
License GNU General Public License 3.0 or later
Download external tarball
Example Naiad.skin.php line 69
Category:All extensions

The DeToc extension extracts and removes the table of contents of a wiki article. In order to work the functions provided by this extension need to be used by the current skin. It is useful for skin programming to move the ToC into a different part of the page.

Usage

Add the following to your LocalSettings.php:

wfLoadExtension( 'DeToc' );

Then include the following line in your skin's BaseTemplate::execute() method:

$new_body = DeToc::RemoveToc( $this->data[ 'bodycontent' ], $extracted_toc );

This way the $new_body variable will contain the article body in HTML without table of contents. The $extracted_toc variable will contain the table of contents without the initial <div id="toc"> and the final </div>.

This extension is used in the updated Naiad skin to move the table of contents to another area of the screen.

See also

Category:TOC extensions
Category:All extensions Category:Extensions with manual MediaWiki version Category:Extensions with master compatibility policy Category:Extensions without an image Category:GPL licensed extensions Category:Personalization extensions Category:TOC extensions Category:Unmaintained extensions