[dokuwiki] New PR: set page context in Handler

  • From: "splitbrain" <wiki@xxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Mon, 28 Sep 2020 17:07:58 +0200 (CEST)

Hi,

splitbrain opened a new pull request at 
https://github.com/splitbrain/dokuwiki/pull/3267:

Under some circumstances it is useful to know if the current parsing process is 
running in a page context or not.

One of the examples is the struct plugin's use of the PARSER_HANDLER_DONE event 
to automatically inject its own output instruction. Currently this instruction 
is injected in each and every processing and only on rendering is decided if 
there is anything to output.

This patch injects a page hint into the Handler when the handler was created 
from our p_wiki_xhtml() method (and only then). Plugins can use the getPage() 
method to check the context if needed.

Note: currently p_wiki_xhtml() also modifies the global $ID variable which 
might also used as context hint (but will also be set during on-the-fly 
renders, eg. the preview intro text).

It would probably be a good idea to check if it would be better when all handle 
methods rely on getPage() instead of global $ID instead. This would be a major 
change in parsing though and needs serious testing while this addition has 
basically no consequences currently.

Please help us to review this pull request, so new contributors get feedback in 
a timely manner.

640c8480-019c-11eb-97d7-2237c92b21ae


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

Other related posts:

  • » [dokuwiki] New PR: set page context in Handler - splitbrain