Jump to content

Extension:TocTree: Difference between revisions

From mediawiki.org
Content deleted Content added
No edit summary
m 26 revisions imported: Import history from "TocTree extension" in https://archive.org/details/wiki-wikivoyage_oldorg_w_tech
 
(5 intermediate revisions by 4 users not shown)
Line 17: Line 17:
|phabricator = MediaWiki-extensions-TocTree
|phabricator = MediaWiki-extensions-TocTree
}}
}}
The '''TocTree''' extension allows for initial expansion and collapsing of the table of contents.

<translate>
<translate>
<!--T:6-->
The <tvar name=1>'''TocTree'''</tvar> extension allows for initial expansion and collapsing of the table of contents.

==Installation== <!--T:2-->
==Installation== <!--T:2-->
</translate>
</translate>
Line 29: Line 30:
<translate>
<translate>
== Customization == <!--T:3-->
== Customization == <!--T:3-->

</translate>
<!--T:7-->
The PHP script will add two new options to the user preferences. They were added to the Misc section:
The PHP script will add two new options to the user preferences. They were added to the Misc section:
</translate>


* Floated table of contents
* <translate><!--T:8--> Floated table of contents</translate>
* Expand table of contents
* <translate><!--T:9--> Expand table of contents</translate>


Defaults are collapsed but not floated tocs. You can overwrite the default values by setting true in your LocalSettings.php file:
<translate><!--T:10--> Defaults are collapsed but not floated tocs.</translate>
You can overwrite the default values by setting true in your LocalSettings.php file:


<syntaxhighlight lang="php">
<syntaxhighlight lang="php">
Line 53: Line 57:
<translate>
<translate>
== Known problems == <!--T:5-->
== Known problems == <!--T:5-->

</translate>
<!--T:11-->
There are the well-known problems of floated boxes like:
There are the well-known problems of floated boxes like:
</translate>


* Missing list bullets
* <translate><!--T:12--> Missing list bullets</translate>
* Design problems of narrow TOCs and positioning problems with text and wide right-floated boxes.
* <translate><!--T:13--> Design problems of narrow TOCs and positioning problems with text and wide right-floated boxes.</translate>


<translate>
<!--T:14-->
Additional:
Additional:
</translate>


* Bidi support (right-to-left writing direction) implemented but not yet tested (for instance needed for Hebrew and Arabic).
* <translate><!--T:15--> Bidi support (right-to-left writing direction) implemented but not yet tested (for instance needed for Hebrew and Arabic).</translate>
* Support of only the MonoBook and Vector skins.
* <translate><!--T:16--> Support of only the MonoBook and Vector skins.</translate>


{{OnWikimedia}}
{{OnWikimedia}}
{{Used by}}


[[Category:TOC extensions{{#translation:}}]]
[[Category:TOC extensions{{#translation:}}]]

Latest revision as of 17:36, 10 May 2025

MediaWiki extensions manual
TocTree
Release status: stable
Implementation User interface
Description Allows for expansion and collapsing of the table of contents
Author(s) Roland Unger, Matthias Mullie
Latest version 1.12.0
MediaWiki >= 1.47.0
Licence GNU General Public License 2.0 or later
Download
Translate the TocTree extension if it is available at translatewiki.net
Issues Open tasks · Report a bug

The TocTree extension allows for initial expansion and collapsing of the table of contents.

Installation

[edit | edit source]
  • Download and move the extracted TocTree folder to your extensions/ directory.
    Developers and code contributors should install the extension from Git instead, using:
    cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/TocTree
    
  • Add the following code at the bottom of your LocalSettings.php file:
    wfLoadExtension( 'TocTree' );
    
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Customization

[edit | edit source]

The PHP script will add two new options to the user preferences. They were added to the Misc section:

  • Floated table of contents
  • Expand table of contents

Defaults are collapsed but not floated tocs. You can overwrite the default values by setting true in your LocalSettings.php file:

$wgDefaultUserOptions['toc-floated'] = false;
$wgDefaultUserOptions['toc-expand'] = false;

Prevention of TOC floating

[edit | edit source]

The author has the opportunity to prevent floating of the TOC set by the user(s) by using a div tag with the style class noFloat enclosing the TOC.

<div class="noFloat">__TOC__</div>

Known problems

[edit | edit source]

There are the well-known problems of floated boxes like:

  • Missing list bullets
  • Design problems of narrow TOCs and positioning problems with text and wide right-floated boxes.

Additional:

  • Bidi support (right-to-left writing direction) implemented but not yet tested (for instance needed for Hebrew and Arabic).
  • Support of only the MonoBook and Vector skins.