[pmwiki-devel] page text variables across groups with Attach:

Peter Bowers pbowers at pobox.com
Thu Dec 16 04:12:33 CST 2010


On Wed, Dec 15, 2010 at 11:45 PM, John Rankin
<john.rankin at affinity.co.nz> wrote:
> I don't see an easy way to tell pmwiki to retrieve the "graphic" PTV as
> Attach:GroupA/an-image.png instead of just Attach:an-image.png, if that's
> what the author entered -- I can't rely on people remembering to insert a
> groupname when they set up a (:graphic: Attach:an-image.png :) PTV.

This moves out of the "easy" category because there may be a lot of
little conditions to check, but it looks like to me your custom markup
is going to have to do variable substitution[1] for {$:graphic}, parse
it, and add in the group name...  Of course if someone does put in the
"Group./" prefix then you'll have to identify that and deal with it --
probably other edge conditions as well...

Either that or else move away from per-group uploads and just keep
them in one central directory...

-Peter

[1]This code adapted from stdmarkup.php, '{$:var}' rule, to do ptv substitution:

 $foo = '{$:test}';
 $foo = preg_replace('/\\{(\\*|!?[-\\w.\\/\\x80-\\xff]*)(\\$:?\\w+)\\}/e',
 "PRR(PVSE(PageVar(\$pagename, '$2', '$1')))", $foo);



More information about the pmwiki-devel mailing list