Extension:StyleByHeaderTree

Category:Unmaintained extensions#StyleByHeaderTree Category:Extensions without an imageCategory:Extensions without a compatibility policyCategory:GPL licensed extensions
MediaWiki extensions manual
StyleBySection
Release status: unmaintainedCategory:Unmaintained extensions
Implementation Page action Category:Page action extensions
Description Wraps sections according to header hierarchy. Gives class and id to the wrapping divs according to section title.
Author(s) François Moreau
Latest version 1.1 (2008-10-22)
MediaWiki 1.8+Category:Extensions with manual MediaWiki version
Database changes No
License GNU General Public License 2.0
Download Category:Extensions in SourceForge version control
Category:All extensionsCategory:Extensions not in ExtensionJson

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.

Usage

This is useful for styling, javascripting and adding semantics. This allows for a richer presentation without additional intervention from the authors, as long as certain conventions exist regarding section headers. In our organization, we have used this primarily as a mean to bring stronger semantics to wiki pages, which was then used to produce XML content with further extensions.

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

Example of rules file

extensions/headerTree/example.yml:

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

Installation

Category:All extensions Category:Extensions in SourceForge version control Category:Extensions not in ExtensionJson Category:Extensions not using extension registration Category:Extensions with manual MediaWiki version Category:Extensions without a compatibility policy Category:Extensions without an image Category:GPL licensed extensions Category:OutputPageBeforeHTML extensions Category:Page action extensions Category:Unmaintained extensions Category:View page extensions