[Pmwiki-users] help needed for custom markup

Benoit Pointet info
Tue Dec 28 17:45:13 CST 2004


How elegant and efficient!

THANKS,

b.


Le 28 d?c. 04, ? 20:34, Patrick R. Michaud a ?crit :

> 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:
>>    play:RELPATH
>> that will create such a HTML tag:
>>
>> <a href="player.php?path=RELPATH" target="player"><img
>> src="track.png"/></a>
>> but i've never really studied regexps and need help concerning this
>> markup:
>> - 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';
>    $IMapLinkFmt['play:'] =
>      "<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]].
>
> Pm




More information about the pmwiki-users mailing list