1 Nov 2009 20:35
parapgraphs in block syntax plugins
Anika Henke <anika <at> selfthinker.org>
2009-11-01 19:35:52 GMT
2009-11-01 19:35:52 GMT
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(Continue reading)
. Some code cleanup and test units updated.
(potentially affecting all templates).
RSS Feed