Extension:ExpandTemplates


 * Bug: parameter substitution does not work anymore.

Special:ExpandTemplates provides an input box to enter wikitext, and another one to enter a pagename, and produces expanded wikitext, i.e., templates, parser functions and variables are expanded recursively; variables depending on pagename are expanded based on the supplied pagename. It also shows how the produced wikitext is rendered. This is typically the same as how the original wikitext is rendered, but not always.

In special cases the expanded wikitext changes when expanded again: this may apply e.g. if a template is expanded containing "|" or braces: in this case these characters are treated as plain text in the expansion as applied by ExpandTemplates, and, accordingly, in page rendering. This is used in, which provides a way to allow "|" in a parameter value of a template or parser function, in particular for use in table syntax.

This template can be used with ExpandTemplates to perform partial substitution.

The table, using, allows comparison of the wikitext produced with simple substitution and with ExpandTemplates (recursive substitution). It also shows that "subst" prevents ExpandTemplates from expanding the template. It also demonstrates, using also }, that a template call with a parameter separator "|" in the form | prevents ExpandTemplates from expanding the template, except when the template call is in a parser function call, because that causes an extra pass through the expansion process (compare m:Help:Recursive_conversion_of_wikitext). By comparison, there is no such extra pass when the template call is in another template call, as the example with shows. In the case of this extra pass a parameter separator "|" in the form can be used, etc.

Installation

 * 1) Download the files from SVN and place them to extensions/ExpandTemplates
 * svn co http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/ExpandTemplates
 * 1) Make sure you have ExtensionFunctions.php - if not, download it from SVN
 * 2) Add the following at the end of your LocalSettings.php: