MediaWiki extension: Labeled Section Transclusion (extended)

InfoDabble > Tech Notes > MediaWiki > MediaWiki extension: Labeled Section Transclusion (extended)
Jump to: navigation, search
This project is still under development.
This is a MediaWiki Extension
Labeled Section Transclusion

Release status: beta

Description: enables marked sections of text to be transcluded
Author: Steve Sanbeg, Eric Hartwell
Version: svn:23229 (June 22, 2007)
MediaWiki: 1.7+
Download: SVN

The Labeled Section Transclusion extension allows selective transclusion of marked-off sections of text. Its functionality is similar to the <onlyinlcude> tag with normal wiki transclusion.

While normal transclusion is primarily intended to transclude large portions of small templates, labeled section transclusion is intended for small portions of large pages. Sections are marked by name, and behavior is chosen by the caller, which can include or skip sections as needed. Different pages can include or exclude selected sections; there can be arbitrary numbers of sections, which can also overlap arbitrarily.

Extending lst

It would be extremely useful to add a link back to the source... but does that mean a bookmark in the source document?

Linkback

The transcluded text should optionally include a link back to the original location on the original page.

This is fairly easy for named sections since all it needs is a bookmark at the location of the <nowiki><section begin=></nowiki> tag. The MediaWiki Handbook suggests using the HTML code <nowiki><span id="anchor_name"></span></nowiki> for arbitrary anchor names.

  • When the target page is built, the <nowiki><section begin=></nowiki> tag is treated as an XML-style extension that inserts the anchor span.
  • When the page is transcluded, the <nowiki><section begin=></nowiki> tag should be left unchanged - or should it generate the section link?

When transcluding visual headings, it's even easier, since MediaWiki already tags all headings as bookmarks.