This extension is currently not actively maintained! Although it may still work, any bug reports or feature requests will more than likely be ignored.
Release status: unmaintained
|Description||Wraps sections according to header hierarchy. Gives class and id to the wrapping divs according to section title.|
|Latest version||1.1 (2008-10-22)|
|License||GNU General Public License 2.0|
The StyleByHeaderTree extension does two things to rendered XHTML pages:
- it wraps each section according to the nesting hierarchy of their respective headers;
- it may give a class and/or an id to each wrapping div, depending on the header's content and the set of rules defined for the plugin.
The directives associating headers with classes and id are written in a YAML file. Each rule specifies what class and id will be given to the created wrappers' header matching a regular expression or an exact string.
Your Wiki's MediaWiki:Monobook.css may then be edited to give style to the containers according to their classes and id.
- Example of rules file
intro: is: Introduction attr: class: intro question: match: ^Question [0-9]+$ attr: id: question-[COUNTER] class: question answer: is: Answer attr: class: answer code-color: match: ^Code\s+(.*)$ attr: class: code-$1
- Download, extract and place the file(s) in a directory called
- Add the following code at the bottom of your LocalSettings.php:
require_once "$IP/extensions/headerTree/headerTree.php"; $wgHooks['OutputPageBeforeHTML'] = array( new HeaderTree(), 'apply', //change this string according to your new rules file's path "$IP/extensions/headerTree/example.yml" );
- Create a new .yml rules file fitting your needs.
- Edit your wiki's MediaWiki:Monobook.css to use the new classes and id.
- Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.