Extension:ParserPower
Appearance
Please expand this page. |
ParserPower Release status: unknown |
|
---|---|
Implementation | Parser function , Tag |
Author(s) |
|
Latest version | 1.2.0 |
MediaWiki | 1.41+ |
Database changes | No |
License | GNU General Public License 2.0 or later |
Download | GitHub: Note: |
Installation
[edit]- Download and place the file(s) in a directory called
ParserPower
in yourextensions/
folder. - Add the following code at the bottom of your LocalSettings.php file:
wfLoadExtension( 'ParserPower' );
- Done â Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
Usage
[edit]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:}}