[dokuwiki] Re: plugin question: nesting?
- From: "Chris Smith" <chris@xxxxxxxxxxxxx>
- To: <dokuwiki@xxxxxxxxxxxxx>
- Date: Tue, 26 Jul 2005 01:52:01 +0100
Hi,
allowedModes are other syntax modes (other dokuwiki markup) that is allowed
to be nested within your plugin's own mode (its markup). Your plugin's
markup is only allowed to be nested within other dokuwiki markup if its mode
type is included in their own allowedModes. e.g. Almost no standard
dokuwiki syntax mode includes $PARSER_MODES['container']. So if your plugin
declares itself to be of mode type container you won't be able to use it
nested within any other Dokuwiki syntax.
That bit of extra code to go in the connectTo method is no longer required,
check out the sample code posted in syntax_plugins#using_allowedmodes.
There is an additional line (the last line) in the accepts() method to
remove the current plugin from the list of its allowed modes (which is what
that get_class(...) line did). Also, there is a discussion going on at
present regarding adding an additional method to the plugin class,
getAllowedModes() which if accepted will remove the requirement for the
accepts() override method and leave you writing something along the lines of
function getAllowedTypes() {
return array('container', 'formatting', 'protected', 'disabled',
'substition');
}
I haven't yet found any effect from having different values returned by
getSort. I suspect, that unless the entry/exit patterns of your plugin
clash with some other syntax modes' patterns the sort value will have no
effect.
Cheers,
Chris
> -----Original Message-----
> From: dokuwiki-bounce@xxxxxxxxxxxxx
> [mailto:dokuwiki-bounce@xxxxxxxxxxxxx]On Behalf Of ytrewq1
> Sent: 26 July 2005 01:17
> To: dokuwiki@xxxxxxxxxxxxx
> Subject: [dokuwiki] Re: plugin question: nesting?
>
>
> Thanks for the response.
>
> On 7/26/05, Chris Smith <chris@xxxxxxxxxxxxx> wrote:
> > Which parser modes are you including?
>
> First, I started with what was on the using_allowedmodes page, since
> then I've tried:
>
> $this->allowedModes = array_merge (
> $PARSER_MODES['container'],
> $PARSER_MODES['baseonly'],
> $PARSER_MODES['formatting'],
> $PARSER_MODES['substition'],
> $PARSER_MODES['protected'],
> $PARSER_MODES['disabled'],
> $PARSER_MODES['paragraphs']
> );
>
> > If your plugin is of type container, you should probably
> include everything
> > except other containers. Refer to the page
> > http://wiki.splitbrain.org/wiki:syntax_plugins#using_allowedmodes
>
> ...as well as leaving out 'container' and a few other combinations.
>
> I'm not sure I follow what you mean by / how to 'include
> everything except
> other containers' -- is there a way to exclude things at a
> finer granularity
> than 'containers'?
>
> It's been clear to me from when I started trying to put a
> plugin together
> that I'm not really getting the concepts behind the modes -- I've
> looked at the comments in inc/parser/parser.php, but that
> hasn't helped
> my understanding. Any help in resolving my lack of understanding
> would be appreciated.
>
> > Also take a look at the code posted for the folded plugin,
> slightly modified
> > version at http://wiki.splitbrain.org/plugin:inline_folding2
>
> I haven't yet noticed too much that's different -- though I'm
> not counting
> folded_count and I'm not using Javascript. I've tried
> modifying the value
> returned by getSort() as well, but I confess I don't really
> get that either.
>
> Commenting/uncommenting:
>
> if ($mode == substr(get_class($this), 7)) {
> return;
> }
>
> doesn't seem to have an effect in the simple nesting case
> that I'm testing.
> BTW, is that something that should be done in the
> inline_folding plugin
> too?
>
> On a side note, is there something that can be done to hide
> away instances
> of:
>
> substr(get_class($this), 7)
>
> ? I imagine it'll be a bit disturbing to have to come back
> to that in a while
> and wonder what that means...
> --
> DokuWiki mailing list - more info at
> http://wiki.splitbrain.org/wiki:mailinglist
>
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist
- Follow-Ups:
- [dokuwiki] Re: plugin question: nesting?
- From: ytrewq1
- References:
- [dokuwiki] Re: plugin question: nesting?
- From: ytrewq1
Other related posts:
- » [dokuwiki] plugin question: nesting?
- » [dokuwiki] Re: plugin question: nesting?
- » [dokuwiki] Re: plugin question: nesting?
- » [dokuwiki] Re: plugin question: nesting?
- » [dokuwiki] Re: plugin question: nesting?
- [dokuwiki] Re: plugin question: nesting?
- From: ytrewq1
- [dokuwiki] Re: plugin question: nesting?
- From: ytrewq1