[pmwiki-users] Category Markup

Patrick R. Michaud pmichaud at pobox.com
Sat Dec 17 09:38:55 CST 2005


On Sat, Dec 17, 2005 at 12:55:39AM -0500, DaveG wrote:
> I abandoned the regex from hell, and used a function instead :) Is there 
> such a thing as ReplaceOnEdit?

It can be done with an EditFunction:

   function MyConvertTags($pagename, &$page, &$new) {
     $new['text'] = preg_replace('/^Tags?: *([\\w, ]+)/m', 
                                "TagsToCategories('$1')", $new['text']);
   }

   array_unshift($EditFunctions, 'MyConvertTags');

But it might also be worthwhile for me to define a $ROEPatterns
that can corresponds to $ROSPatterns.

Pm




More information about the pmwiki-users mailing list