[dokuwiki] Re: plugin question: nesting?

Thanks for your patience and efforts toward helping my feeble brain :-)

Response interleaved below.

On 7/26/05, Chris Smith <chris@xxxxxxxxxxxxx> wrote:
>
> 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.

Hmm.  I think it's starting to seep in.  I've tried 'container' and
'formatting'
but I haven't generated a test case which seems to illustrate the
difference in this choice.  May be I can check for concrete instances of
where it might matter -- FWIW, I'm writing this plugin as a fix for a broken 
upgrade.  Apparently, before certain substituion matches could be 
specified in a configuration file, but this doesn't appear to work any 
longer.  In the mean time, there are a number of pages that depend on 
the old syntax so I'm just trying to get things to the point where things
are usable again.
 
> 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.

Actually, that is what I based my original code on -- it was only after
searching the archives and seeing the thread it was mentioned it
that I added it :-)  I should have tried to determine what was most recent,
but more importantly, I should have made note of what I added to the
plug-in code and why.  Need more discipline...

> 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).  

In fact, strangely enough I had this line and removing it appears to fix 
my issue...or at least my simple test case now comes out fine.

> 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');
>   }

Certainly seems visually/conceptually cleaner.  I hope that whatever
gets accepted and I get along w.r.t. nesting :-)

> 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.

Thanks for sharing your experience on this bit too.
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: