Extension:ExpandAfter

No longer needed
You don't need this extension, because the built-in MediaWiki parser function  does the same thing.

Usage
Gives content.

This converts an XML-style extension to a parser function which allows the values of a1 and a2 and the content to depend on template parameters (but not on variables and templates), which is not directly possible within the XML-style tags.

Example: math
For example in template :

Using gives $${ a+b \over 2}$$ ( $${ a+b \over 2}$$ ).

However, and do not work.

Example: nowiki
Template:Demo containing
 * gives

is convenient for demonstrating wikitext syntax. For example:

abc d e gives:
 * abc d e gives abc d e

However, this does not work for demonstrating the expansion of variables and templates, because variables and templates in the expression for the value of a parameter of a template or parser function are expanded before the parameter is used.

See also m:Help:Template documentation.

Installation
require_once( "$IP/extensions/ExpandAfter.php");

ExpandAfter.php:

setFunctionHook( 'expandafter', 'expandAfterHook' ); $wgParser->setFunctionHook( 'ea', 'expandAfterHook' ); } function expandAfterHook($parser) {

$args = func_get_args; array_shift($args);

$tag = array_shift($args); $attrs = array_shift($args); $content = implode('|',$args);

return "$content"; } function expandAfterLanguageGetMagicHook( &$magicWords, $langCode = 'en' ) { $magicWords['ea']   = array( 0, 'ea'); $magicWords['expandafter']   = array( 0, 'expandafter'); return true; }

$wgExtensionFunctions[] = 'expandAfterInit'; $wgHooks['LanguageGetMagic'][] = 'expandAfterLanguageGetMagicHook';

?>