PmWikiPlus-Talk

Summary: Talk page for PmWiki Plus.
Maintainer: simon
Users: +1 (View / Edit)

This space is for User-contributed commentary and notes. Please include your name and a date along with your comment.

Creating custom Markup Expressions

The $MarkupExpr array is used to register Markup Expressions for processing by PmWiki. Each entry's key is the name of the Markup Expression. The entry's value is the code to be evaluated for that expression. e.g.

$MarkupExpr['fnmrkupexpr'] = 'mymrkupexprfunc()';
$MarkupExpr['cdmrkupexpr'] = 'PHP code'; 

When the expression is evaluated there are three parameter options that can be used:

  • $params is a simple string that contains all the text from the markup expression name to the closing brackets including leading and trailing spaces,
    e.g. $MarkupExpr['myparams'] = 'myparams($params)';
  • $args is a simple array strings, space separated tokens from the markup expression's text string, actually this is the [''] array returned by ParseArgs(). Specific arguments can be used as parameters, parameters such as key='val' are not available.
    e.g. $MarkupExpr['myargs'] = 'myargs($args[0], $args[1])'; .
  • $argp is the output from returned by ParseArgs() with the standard entries for %['#'], %[''], %['+'], %['-']. Specific arguments can be used as parameters,
    e.g. $MarkupExpr['myargp'] = 'myargp($argp['key'], $argp['ext'])';

Talk page for the PmWiki Plus recipe (users).