[Pmwiki-users] help needed for custom markup
Patrick R. Michaud
Tue Dec 28 12:35:39 CST 2004
On Tue, Dec 28, 2004 at 12:22:09AM +0100, Benoit Pointet wrote:
> i'm using PmWiki as part of an electronic music band website, the other
> part being a mp3 browser/player.
> i want to have a new markup:
> that will create such a HTML tag:
> <a href="player.php?path=RELPATH" target="player"><img
> but i've never really studied regexps and need help concerning this
> - could somebody be kind enough to hack a markup declaration for me?
> - where should i add it? in local/config.php?
You can actually do this without using regexps or the markup function.
Just set the following variables in local/config.php:
$LinkFunctions['play:'] = 'LinkIMap';
$IMap['play:'] = 'player.php?path=$1';
"<a target='player' href='\$LinkUrl'><img src='track.png' /></a>";
The nice thing about doing it this way (as opposed to using Markup() )
is that PmWiki automatically knows which characters are valid in urls,
will url-encode characters as needed, and automatically handles markup like
[[play:some path with spaces]] and [[(play:)mysong.mp3]].
More information about the pmwiki-users