[dokuwiki] $pos and Plugins & PType
- From: Chris Smith <chris@xxxxxxxxxxxxx>
- To: dokuwiki@xxxxxxxxxxxxx
- Date: Wed, 05 Apr 2006 18:37:12 +0100
Hi,
Plugins and PType are a mess[1].
$pos is faithfully kept intact through the whole rendering process, but
AFAIK is not used anywhere outside the lexer. I believe it represents
the character position in the wiki page of the location of the first
character in the syntax pattern that started the chain of events that
lead to the particular rendering instruction being created.
I'd like to swap it for l"lexer state" ( at least for the plugin
instructions). That will give the block handler some indication of what
is happening with the plugin and allow it to:
- open a block/stack on enter
- do nothing on matched and unmatched
- close a block/stack on exit
I'd also like to remove the unused "plugin_$name_open",
"plugin_$name_close" array entries. These aren't used anywhere at
present and can not be used without a revamp of the way syntax modes are
used by the handler and renderer. That is the syntax mode is used as the
plugin class name. To add any extra information to it would stop the
plugin being called and probably cause a fatal php error.
Cheers,
Chris
[1] At present the block handler will squeeze an open instruction before
each plugin instruction and force a close instruction after each plugin
instruction.
For a plugin of PTtype = block with the following sequence of render
instructions ....
DOKU_LEXER_ENTER
DOKU_LEXER_UNMATCHED
(to some nested syntax mode)
DOKU_LEXER_UNMATCHED
DOKU_LEXER_MATCHED
DOKU_LEXER_UNMATCHED
DOKU_LEXER_EXIT
the block handler will generate the following sequence ...
p_close
DOKU_LEXER_ENTER
p_open
p_close
DOKU_LEXER_UNMATCHED
p_open
[p_close]
(to some nested syntax mode)
[p_open]
p_close
DOKU_LEXER_UNMATCHED
p_open
p_close
DOKU_LEXER_MATCHED
p_open
p_close
DOKU_LEXER_UNMATCHED
p_open
p_close
DOKU_LEXER_EXIT
p_close
Which is crazy!
Cheers,
Chris
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist
Other related posts: