Extension:WhiteSpace

What?
Two tags to control whitespace in templates:  discards itself and all whitespace (including newlines) after the tag,   replaces itself with newline.

Why?
In wikitext spaces and newlines do matter. Leading space causes a paragraph to be verbatim, newline terminates a list item, etc. This means that template code cannot be formatted freely. For example, two subsequent template calls:

being reformatted as:

may produce different result (e. g. two list items instead of one). This is not a big deal for a simple template, but it quickly become a real issue for complicated templates. Let us consider a real example, a small part of Template:Extension:

HTML comments allows splitting template code to lines but it pollutes template code so overall result is not so good. Using  the code can be reformatted as:

Of course, it is just another style of formatting, but  allows using this style regularly and uniformly.

Download
svn checkout https://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/WhiteSpace

Installation
Note: This extension requires patching MediaWiki core. One-line patch introduces a parser hook which makes implementation of this extension possible. See Requests for comment/New hook: ParserBeforePreprocess for rationale.

In MediaWiki root directory:

$ patch -p0 -i extensions/WhiteSpace/MediaWiki-1.18.1.patch

The add to your `LocalSettings.php':

require_once( "$IP/extensions/WhiteSpace/WhiteSpace.php" );

Configuration
No configuration.

Known issues

 * Patching the MediaWiki core required. :-(

License
GNU Affero General Public License, version 3 or any later version. See AGPL-3.0.txt file for the full license text.