Extension:ParserPower

Category:Pages to be expanded#ParserPower Category:Extensions without an imageCategory:Extensions without a compatibility policyCategory:GPL licensed extensions
MediaWiki extensions manual
ParserPower
Release status: stableCategory:Stable extensions
Implementation Parser function Category:Parser function extensions, Tag Category:Tag extensions
Author(s)
Latest version 1.2.0
MediaWiki 1.41+Category:Extensions with manual MediaWiki version
Database changes No
License GNU General Public License 2.0 or later
Download Category:Extensions in GitHub version control
Category:All extensionsCategory:Extensions not in ExtensionJson

Installation

  • Download and place the file(s) in a directory called ParserPower in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php file:
    wfLoadExtension( 'ParserPower' );
    
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Usage

ParserPower provides several parser functions, most notably {{#or:param1|param2|param3|...}}, which returns the first nonempty value passed. This can be used as a syntax sugar for {{#if:{{{1|}}}|{{{1}}}|default}}, and if {{{1|}}} is instead a value requiring an expensive computation that won't get cached (e.g. the result of a Cargo query), it provides a Variables-free approach to do the computation only once.

Other parser functions include:

  • {{#follow:page title}}, returning a page's name or its redirect target (expensive the first time it's used on a particular page)
  • {{#arraymap:value | delimiter | variable | formula | new_delimiter | conjunction}} as in Page Forms (will not load if Page Forms is also installed)
  • {{#arraymaptemplate:value | template | delimiter | new_delimiter}} as in Page Forms (will not load if Page Forms is also installed)
  • Several list-handling functions:
    • {{#lstcnt:list|separator}}
    • {{#lstsep:list|input separator|output separator}}
    • {{#lstelem:list|input separator|index}} (1-indexed)
    • {{#lstsub:list|input separator|output separator|start index|length}}
    • {{#lstfnd:item to find|list|separator|case sensitivity option}}
    • {{#lstind:item to find|list|separator|options}}
    • {{#lstapp:list|separator|new item}}
    • {{#lstprep:new item|separator|list}}
    • {{#lstjoin:first list|first input separator|second list|second input separator|output separator}}
    • {{#listfilter:}}
    • {{#lstfltr:items to keep|items separator|list|input separator|output separator|case sensitivity option}}
    • {{#lstrm:item to remove|list|input separator|output separator|case sensitivity option}}
    • {{#lstcntuniq:list|separator|case sensitivity option}}
    • {{#listunique:}}
    • {{#listsort:}}
    • {{#listmap:}}
    • {{#listmerge:}}
Category:Extensions by wiki.gg
Category:All extensions Category:Extensions by wiki.gg Category:Extensions in GitHub version control Category:Extensions not in ExtensionJson Category:Extensions with manual MediaWiki version Category:Extensions without a compatibility policy Category:Extensions without an image Category:GPL licensed extensions Category:Pages to be expanded Category:ParserFirstCallInit extensions Category:Parser function extensions Category:Stable extensions Category:Tag extensions