On 24/03/10 10:46 AM, DaveG wrote:


On 3/23/2010 2:55 PM, DaveG wrote:
I'm trying to use MarkupToHTML() to convert some PmWiki markup into HTML
-- which is what I think the function does.

However, a simple test, in config.php (or my recipe, same result):
print (MarkupToHTML($pagename, '[[http://google.com/ | Google]]'));
Since MarkupToHTML() obviously works, I decided to stop testing, and just implement the feature I was working on. Everything now works. The problem I suspect is that MarkupToHTML() cannot be called in config.php. Not sure why it didn't work within the body of the recipe, but I'm guessing it was called to early in the process.

If someone can describe the scenario or points in processing where MarkupToHTML() should/not work I'll update the wiki.
As I understand it, MarkupToHTML requires a populated markup table, which gets built after pmwiki has loaded the standard markup rules. This happens after it has loaded all local markup rules. So MarkupToHTML can be called only when a markup rule is evaluated.

Also, you may want to consider something like:

  global $MyMarkupFunction;
  SDV($MyMarkupFunction, 'MarkupToHTML');

$mydata = $MyMarkupFunction($pagename, 'some text and markup to be evaluated');

For an example of this usage, see scripts/pagelist.php and the FPLTemplate function. This enables co-existence with any third party recipes which modify the MarkupToHTML function.

JR

--
John Rankin
Affinity Limited
T 64 4 495 3737
F 64 4 473 7991
M 021 RANKIN
john.ran...@affinity.co.nz
www.affinity.co.nz


_______________________________________________
pmwiki-devel mailing list
pmwiki-devel@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-devel

Reply via email to