[dokuwiki] parapgraphs in block syntax plugins
- From: Anika Henke <anika@xxxxxxxxxxxxxxx>
- To: dokuwiki@xxxxxxxxxxxxx
- Date: Sun, 01 Nov 2009 19:35:52 +0000
Hi list,
There is one general problem I came across in several syntax plugins
which allow paragraphs in block level elements.
Inline syntax is no problem (getPType() 'normal').
For block syntax you'd normally use: getPType() 'block'.
But there's one problem with block syntax with allowed type
'paragraphs': A new paragraph will only be created when the entry syntax
is followed by two new lines.
Many plugins (e.g. blockquote) bypass this problem by setting getPType()
to 'stack' and closing one </p> before the rendered output and one
opening <p> after the rendered output. (The empty <p>s will get cleaned
up by DokuWiki automatically afterwards anyway.)
But this is not particularly good style and causes potentially problems
elsewhere.
I had a short discussion with Chris about this a while ago:
http://irclog.dokuwiki.org/index.php?d=2009-10-04#msg199980
I must admit I don't understand enough of the code. What I understood is
this ideally should be fixed in the core or alternatively could be fixed
in a plugin with a kind of "hack" by smuggling two EOLs into the code.
I tried adding two $handler->_addCall('eol',array(),$pos); into the
DOKU_LEXER_ENTER case of handle(). But that doesn't work. It seems
DOKU_LEXER_ENTER is too early (?). (It works in DOKU_LEXER_UNMATCHED,
but that's the wrong place anyway, of course.)
Does anyone know if there is a quick fix to circumvent this behaviour?
If there's no simple solution I'd rather go with the "dirty" solution
(see above, with 'stack' and closing the </p>) and wait for the fix in
the core.
By the way, this is for my wrap plugin
[http://www.dokuwiki.org/plugin:wrap]. If any of you haven't seen it
yet, it's worth checking out. It's a universal plugin which combines
functionalities of tons of other syntax plugins.
Thanks,
Anika
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist
Other related posts: