[pmwiki-users] Announcement: Page Variable Extensions recipe

Dominique Faure dominique.faure at gmail.com
Thu Jun 29 02:06:09 CDT 2006


Announcing (officially) the Page Variable Extensions recipe at:

http://www.pmwiki.org/wiki/Cookbook/PageVariableExtensions

This recipe enhances the variable features in several ways, providing
markup and suffixes functions to dynamically initialize and manipulate
their values in wiki's pages such as:

(:set msg='{$Name:toupper} is here!':)
oyez, oyez, {$msg}

which would render as:

oyez, oyez, PAGEVARIABLEEXTENSIONS is here!

Roughly, the recipe provides the (:set ...:) markup directive to
initialize/assign page variables, eventually using previously defined
ones (cf. sample above), including a way to handle conditional
assignation as in:

(:set flag=1 mood='?(eq {$flag} 1) "nice" "weird"':)
"This recipe is {$mood}"

rendering as example below according to the value of the {$flag} variable:

"This recipe is nice"

Most of the native simple text manipulation functions provided by PHP
are available as Suffixes functions, and the recipe may be easily
enhanced with your own ones if needed. Function calls calls may be
chained as in:

{$Namespaced:tolower:replace ' ' '_'}

which would transform "PageVariableExtensions" to
"page_variable_extensions", and with the help of a modified variable
syntax allow computed values during argument passing as in:

(:set var='abcdef' s1=2 s2=4:)
{$var:sub <$s1> 3} / {$var:sub <$s2> 3}

which renders as: cde / ef

Regards,
Dom




More information about the pmwiki-users mailing list