[dokuwiki] Re: plugin causes empty <p> paragraph

  • From: Chris Smith <chris@xxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Sat, 11 Mar 2006 01:08:02 +0000

Chris Smith wrote:

That'll work, but its inefficient. p_close is called for every paragraph close, so executing a regex on the output so far, each time a paragraph is closed isn't the best.

It could make sense to check for empty para at that point, but a preg function wouldn't be the best method.

I'd move the regex up to document_end(). Its the last instruction in the wiki page instruction list. Slot in the preg_replace line in above the TOC prepending. (around #91)

Cheers,

Chris
This is probably a better pattern too ...

$this->doc = preg_replace('#<p(>| .*?>)\s*</p>#','',$this->doc);
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: