[dokuwiki] Re: Allow header in a syntax plugin

  • From: Guillaume Turri <guillaume.turri@xxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Sat, 10 Oct 2009 18:02:11 +0200

Christopher Smith a écrit :
Headers are a special case, they also affect the table of contents and editable sections of the wiki page. I don't believe you can include dokuwiki's own header handling within your own syntax plugin.

You can, however, instigate your own headers with the same syntax within your syntax mode. There are two ways to do this.

1. Use addPattern to add the same header regex and handle headers within the same syntax plugin.

2. Add a second syntax plugin (or plugin component) to handle the same header pattern. For safety, implement the "accepts" method and only respond true when the requested mode is that for your main syntax plugin.

Syntax plugins don't usually have to handle "accepts", the parent plugin class takes care of it based on the value returned getAllowedTypes().

At this point your headers won't be in the TOC and you won't have any edit buttons. Adding to TOC should be pretty straight forward, reviewing the DokuWiki header code should show you how to do that. Getting your own editable sections will be more complex. A review of DokuWiki's code should give you some ideas. :)

- Chris
I didn't realized the implications the headers have with the TOC and the editable sections.

Thank you very much for this information!

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

Other related posts: