Extension:ParserPower
Appearance
Please help expand this page. |
Release status: stable |
|
|---|---|
| Implementation | Parser function, Tag |
| Author(s) |
|
| Latest version | 1.2.0 |
| MediaWiki | 1.41+ |
| PHP | >= 8.1 |
| 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
ParserPowerin 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:}}
See also
[edit]| This extension is included in the following wiki farms/hosts and/or packages: This is not an authoritative list. Some wiki farms/hosts and/or packages may contain this extension even if they are not listed here. Always check with your wiki farms/hosts or bundle to confirm. |
