Extension:Parser Fun

Usage
The Parser Fun extension Enhances MediaWiki with the following features:

The "THIS:" prefix
is a prefix for site information related magic words. With PAGENAME for example it can be used as. This allows to get the information from the page the phrase actually is literally defined on instead of the page which is being parsed and where the phrase was expanded into. is a synonym for. If  is being used with an unsupported variable it will be interpreted as template call. Currently the following functions are supported: as well as their URL-encoded equivalents ending with. It is possible for other extensions to support the  prefix, currently it is supported by
 * FULLPAGENAME
 * PAGENAME
 * BASEPAGENAME
 * SUBPAGENAME
 * SUBJECTPAGENAME
 * TALKPAGENAME
 * NAMESPACE
 * SUBJECTSPACE
 * ARTICLESPACE
 * TALKSPACE
 * All Subpage Fun extension variables.

#parse parser function
is a new parser function to do several parser tasks manually on wikitext. The following can be achieved by the parse parser function:
 * Parsing wikitext
 * Unstripping  and general stripped text

By default parse will simply parse the wikitext it receives within its first parameter. There are other parameters to fulfill certain tasks as well:
 * 1 : First parameter is the text which should be parsed and/or unstripped. Don't use, it will ignore all   always and can't be omitted. The parameter value will always be expanded, so it makes sense to use certain templates to escape wikitext first. E.g.:
 * parse : Boolean value whether the input text should really be parsed (can be used to just unstrip some text).
 * unstrip : Defines whether and what kind of content should be unstripped (restored). The following values are allowed:
 * none - nothing will be unstripped (default)
 * nowiki - content within  will be unstripped. Note: certain characters will be escaped after outstripping, so it might not be very useful for parsing that unstripped text.
 * general - everything else than  will be unstripped. This can be content which is intended to be HTML for example.
 * all - will unstrip both, nowiki and general content.

Information for Developers
If you are developer of an magic words or parser function extension such as Extension:Subpage Fun, you can adjust your extension to work with Parser Funs This: as well. Parser Fun provides a hook called GetThisVariableValueSwitch:


 * Define Function :
 * Attach Hook :

The hook works similar to the ParserGetVariableValueSwitch. For more information on hooks, see Manual:Hooks.

Installation
This extension requires the Validator extension which has to be included first.

Once you have downloaded the code, place the ParserFun directory within your MediaWiki extensions directory. Then add the following code near the bottom of your LocalSettings.php file:

Configuration
These configuration variables have to be set in the LocalSettings file after inclusion of Parser Fun.


 * $egParserFunEnabledFunctions: Configuration variable (array) to define which Parser Fun functions should be enabled. To disable parse parser function and only enable the this prefix, one can use: