[pmwiki-users] ConditionalExtensions update and markup considerations
Dominique Faure
dominique.faure.1 at free.fr
Tue May 3 20:20:20 CDT 2005
Hi,
I just finished updating ConditionalExtensions recipe according to your
remarks, aka. having mandatory spaces around boolean operators. Could you
please enable it on the PmWiki page in order to let the sample run, thanks.
In the same mood to one of the last mailing-list topic about PmWiki future
architecture with lead to the PmWikiAdmin group, why not having settable
named properties instead of selected global ${variables}?
The following code could be a starting point to set, get and eventually test
them:
===8<---
Markup('setproperties', '<if', "/\\(:properties(\\s+.*)?\\s*:\\)/e",
"SetProperties(PSS('$1'))");
function SetProperties($args) {
$opt = ParseArgs($args);
foreach($opt as $n => $v) { if($n != '#') $GLOBALS['__PROPERTIES__'][$n] =
$v; }
}
Markup('getproperty','>setproperties', '/{\\$property\\s+(.*)\\s*}/e',
"\$GLOBALS['$1']");
$Conditions['property'] = "ExprProperty(\$pagename, \$condparm)";
function ExprProperty($pagename, $condparm) {
if (!preg_match("/\\s*(\\S+)\\s+(.*?)\\s*$/", $condparm, $match)) return
'';
return isset($GLOBALS['__PROPERTIES__'][$match[1]]) ?
$GLOBALS['__PROPERTIES__'][$match[1]] == $match[2] : false;
}
===8<---
More precisely, I was thinking of a way to embed meta information into
PmWiki pages used for example by a pdf generation action:
===8<---
(:properties paper=a4 orientation=portrait:)
...
===8<---
Regards,
Dom
More information about the pmwiki-users
mailing list