Power Tools

Summary: markup expressions for multi page processing Version: 2008-06-22 Prerequisites: PmWiki 2.2.beta Status: new Maintainer: HansB? Categories: Markup Administration Markup Expressions Download: see Cookbook:PowerTools

Questions answered by this recipe

This section is optional; use it to indicate the types of questions (if any) this recipe is intended to answer.


Various markup expression for multi page processing. Attach:powertools.php Δ contains a number of markup expressions which can be used on multiple or single page operations.

The initial release contains:


returns a comma-separated list of full page names from page names given as parameters. Pagenames can contain wiki wildcards * and ? and names with negative prefix. Wildcards will be expanded into a list. Negative prefixed names will be excluded from the list.
General syntax: (plist PageName1 PageName2 .... -PageName3 -PageName4 ....)

(plist ... sep=\n)
returns list separated by line feeds. sep=LF or sep=CRLF can also be used, plus any string sep='STRING'.
output only list of group names.
as group=GROUPPATTERN but with fmt=groups output:
will give a list of all group names.
character or string inserted between each full pagename. Default is a comma. CR or \n makes new line separations.
PREFIX string is put in front of every name.
SUFFIX string is put behind every name.

Syntax examples:

  • {(plist Cookbook.* -Cookbook.*Skin*)} - pagelist of all pages in group Cookbook less any page which contains 'Skin' in its name.

plist can be used to feed pagelists to other markup expressions (see pagecount and wordcount below), or as input in form processing, for instance in Fox forms to provide a list of target pages, to add wiki wildcard target capabilities.


returns a comma separated list of pagenames. Parameters are the same as for the (:pagelist:) markup, except that the default output format is fmt=csv, a comma-separated list of pagenames. Note that this expression processes pages significantly slower (3 to 4 times) than plist above.

Syntax examples:

  • {(pagelist group=PmWiki)} - list of pages in group PmWiki


  • Syntax: (rename PAGELIST group=GROUP pre=PREFIX suf=SUFFIX)

With input from plist or pagelist returns new pagelist with new Group.PageNames GROUP.PREFIX.PageName.SUFFIX if parameters are specified. Use for page backup forms.


returns count of pages from input of comma-separated pagelist (delivered by expression plist).

Syntax examples:

  • {(pagecount (plist PmWiki.*))} number of pages in PmWiki group.


returns count of words from either a string provided, or a PageName or comma-separated page list.

Syntax examples:

  • {(wordcount)} - number of words on current page.
  • {(wordcount Cookbook.PowerToools)} - number of words on page Cookbook.PowerToools.
  • {(wordcount (plist PmWiki.*))} - number of words of all pages in the PmWiki group.
  • {(wordcount "this is a string")} - number of words in string "this is a string" (4).


returns either previous or next link for wiki trail. If no trailpage is given, all page in current group are used. Syntax: {(trail [next|prev] linktext TrailPageName)}

  • {(trail prev Back TrailPage)} - link to pevious page on trail layed out on TrailPage, link is named "Back".
  • ({trail next Forward )} - link to next in current group (alphabetically sorted list), named "Forward".


Release Notes

  • 2008-06-22: fixed sep=\n for (pagelist ...) to deliver newline separations.
  • 2008-05-06: modified (pagelist) so extra newlines are removed on output (as happened with 'wrap=inline fmt=#simple' and 'fmt=#title')
  • 2008-04-01: removed extra "," at end of (plist) output (crept into yesterdays release)
  • 2008-03-31: added to (plist) options groups= , fmt=groups, pre= , suf= . Fixed bug in comma-separated name= and group= arguments.
  • 2008-03-29: added (trail) for wiki trail links. Added option sep= to (plist), so plist can output other than comma-separated list.
  • 2008-02-16: Added (rename)
  • 2008-02-11a: Modification to (pagelist) to use Keep() for harmonising with WikiSh?. Function rename.
  • 2008-02-11: Modified (pagelist) to work essentially like the pagelist directive, accepting all standard pagelist parameters. Improved (plist) for better input handling, with addition of group= and name= parameters like (pagelist)
  • 2008-02-04: Initial release.

If the recipe has multiple releases, then release notes can be placed here. Note that it's often easier for people to work with "release dates" instead of "version numbers".

See Also