Extension:DeToc
This extension is currently not actively maintained! Although it may still work, any bug reports or feature requests will more than likely be ignored. |
DeToc Release status: unmaintained |
|
---|---|
Implementation | MyWiki |
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. |
MediaWiki | 1.25+ |
License | GNU General Public License 3.0 or later |
Download | external tarball |
Example | Naiad.skin.php line 69 |
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
[edit]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
[edit]- Naiad skin updated for MediaWiki 1.25.0 (original: 2012 Blender's Wiki Naiad skin)
- MediaWiki manual: Manual:Skins , Manual:How to make a MediaWiki skin