[dokuwiki] Re: PARSER_WIKITEXT_PREPROCESS questions

  • From: Christopher Smith <chris@xxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Mon, 4 Mar 2013 02:26:36 +0000

On 3 Mar 2013, at 12:31, lebowski@xxxxxxxxxxxxxxxxxxx wrote:

> Am 2013-03-02 13:35, schrieb lebowski@xxxxxxxxxxxxxxxxxxx:
>> Hi,
>> i want to use the PARSER_WIKITEXT_PREPROCESS event in a action plugin
>> to add things to every wikipage.
>> If i use
>>     $event->data .= "text with **wikisyntax**";
>> it will be also add to every page, notably also on pages like "Recent
>> Changes", "Register", e. g.
>> If I only perform action if $ACT == 'show', i get a problem, e. g. if
>> i made changes in the admin menu, the cache is purged and the page is
>> rendered with do=admin.
> 
> 
>> Is there a way to find out, if  $event->data belong to a "real"
>> wikipage or to "Recent Changes", "Profile", etc.?
> 
> It looks like, that $INFO==null at the time PARSER_WIKITEXT_PREPROCESS is 
> triggered for a "real" wikipage. In case of do=recent, do=login, etc. $INFO 
> isset while triggering PARSER_WIKITEXT_PREPROCESS.
> 
> Maybe, there is a better solution for this problem.
> 

$INFO shouldn't be null at PARSER_WIKITEXT_PREPROCESS, it is set before 
DOKUWIKI_STARTED.

If you want to add something to the end of every page, 
PARSER_WIKITEXT_PREPROCESS is not a suitable event.  All it tells you is its 
before some wiki text is handed to the parser, which could happen from many 
places.  TPL_ACT_RENDER (designed for this specific purpose) and 
TPL_CONTENT_DISPLAY are more appropriate choices.  If the content you wish to 
add is wiki text, put it through the plugin::render() method.  If the content 
is fixed, put in in a file in a plugin language directory and use the 
plugin::locale_xhtml() method to allow dokuwiki to cache the rendered wiki text 
so it can avoid parsing & rendering it each time.

- Chris--
DokuWiki mailing list - more info at
http://www.dokuwiki.org/mailinglist

Other related posts: