[pmwiki-users] Complex links with standard markup?
pbowers at pobox.com
Tue Feb 28 08:41:00 CST 2012
On Tue, Feb 28, 2012 at 2:42 PM, Martin Kerz <mkerz at me.com> wrote:
> is it possible to create complex links using standard markup? I would love to have something like this:
> <a href="Group/Page">
> <p>This is a fine link</p>
> <p><b>that you should click</b></p>
> If not, is there a recipe to provide that kind of functionality?
Something that specific is almost certainly not going to have a
ready-made recipe for it, but making your own custom markup for
something like this is very simple...
Markup('mylinks', 'inline', '/\(:mylinks(.*?):\)/ie',
function MyLinks($pagename, $args)
$opts = ParseArgs($args);
$href = $opts[''];
$link = $opts[''];
...for $finelink and $youshouldclick
$rtn = "<a href=\"".$opts['']."\"<h3>$link</h3><p>$finelink</p><p><b>$youshouldclick</b></p></a>";
Put that in your config.php and then you can access it via markup like this:
(:mylink Group/Page Link "This is a fine link" "That you should click":)
The number of arguments is hardcoded to 4 in the way I've done it --
certainly there are ways you can improve on this (starting with
checking ot make sure there are exactly 4 arguments). But it should
give you a starting direction.
More information about the pmwiki-users