[pmwiki-users] Strip markup to generate plain text

Petko Yotov 5ko at 5ko.fr
Wed Feb 13 08:41:33 CST 2008


On Wednesday 13 February 2008, Hans wrote:
> Wednesday, February 13, 2008, 9:43:24 AM, Peter & Melodye Bowers wrote:
> > [Hans, might a SnipMarkup() function with a
> > corresponding {(SnipMarkup ...)} MX be a good function to have available
> > in PowerTools?  Just a tho't...  I know I could make use of it with
> > WikiSh.]
>
> If the aim is to strip out every PmWiki markup, then this is not an
> easy task. I think we would need a bunch of StripMarkup rules, one for
> each markup, so the StripMarkup engine can use a reverse Markup Table
> with these StripMarkup rules. Basically a reversing engine.
>
> I have no stomach to develop this, sorry. ;-)

How about something like :

  return Keep(strip_tags(MarkupToHTML($MyMarkup), "<p><br>"));

  (strip_tags() is at http://php.net/strip_tags )

This will be very slow if called multiple times, but for some cases it may be 
worth it.


Petko




More information about the pmwiki-users mailing list