[dokuwiki] Re: Plugin Methodology

  • From: Chris Smith <chris@xxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Mon, 07 May 2007 15:47:47 +0100

Myron Turner wrote:
I have written a plugin which sets different access levels for using embedded HTML for selected users. $conf['htmlok'] is left at the default setting of false, but if a user has HTML access, then an action script sets htmlok to true. The permissions are set in an admin script but are enforced in a syntax script. I've been working on this for about a month now, and it's essentially finished. Up until this morning, I've been using the default identifiers for DokuWiki's embedded HTML, which is simply the two html tags between which the embedded html is placed:

     <html>
    <H1>Hello, there</H1>
    </html>

Based on something I read or thought I read when I began the project, I was under the impression that I had to use the <html> tags because DokuWiki already supported embedded HTML and that the markup had to go both through DouWiki's native html parser and my own plugin. But this morning it dawned on me that this might be unnecessary doubling up. I changed the tag to to an arbitrary test name, <html_2>. . .</html_2>
and there was no change in behavior.
I was wondering if anyone could clarify the relationships here. Do I in fact have to engage the native DokuWiki html functionality? And is there in fact some doubling up? Or is there perhaps time saved, because if $conf['htmlok'] is set to true, then the DukuWiki parser can ignore HTML altogether?

Thanks,


Myron Turner

DokuWiki doesn't have an html parser. iirc, the contents between <html> tags are output directly without any subsequent parsing by DW (ie, its a protected syntax mode). There isn't any doubling up either. If you use the same tag as DW, then as long as you use a lower sort number your syntax mode will be used. The DW syntax mode is still there, just never accessed. If you wish to use DW functionality, you would call the DW html syntax mode handler --- eg. $renderer->html($content); --- once you had determined that html was allowed and temporarily overridden the $conf['htmlok'] value. This has the advantage of working with alternate renderers.

A couple of notes, feel free to ignore them if you have already considered these issues.

- DW has a two stage cache. In the first stage the page is converted to instructions. The second stage generates the output format (normally html). Normally the first stage happens when the wiki data is edited and only rarely otherwise (after configuration changes, plugin alterations). Unless you have disabled caching of a page, mostly the page will be served from the output cache - where there is no ability to check the page contents. An action plugin can intervene in the determination of cache use.

- DW access is based on the current visitor rather than on the editor.


Chris
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: