[pmwiki-users] Getting an URL from a cookbook recipe

Dominique Faure dominique.faure at gmail.com
Wed Jan 25 09:17:42 CST 2006


I often need to catch urls from cookbook recipe's markup extensions,
whatever form it could have (according to PmWiki syntax). For now, the
easiest way I found to do that was to "regexp" clean the MakeLink
function output:

Markup('mymarkup', 'directives',
  "/\\(:mymarkup\\s+(.*)\\s*:\\)/e",
  "MyMarkupFunc(\$pagename, PSS('$1'))");

function MyMarkupFunc($pagename, $target) {
  $link = preg_replace("/.*href='([^']+)'.*/", '\1',
MakeLink($pagename, $target, ''));

  # ...
}

This working solution has several drawbacks, as for example not
allowing to know if the given url needs approbation or not.

Any better idea would be appreciated.

Dom




More information about the pmwiki-users mailing list