--- dokuwiki-2011-05-25a/lib/plugins/htmlcomment/syntax.php 2005-10-09 11:31:47.000000000 +1300 +++ dokuwiki/lib/plugins/htmlcomment/syntax.php 2012-01-20 14:03:27.078084422 +1300 @@ -41,15 +41,24 @@ } function connectTo($mode) { - $this->Lexer->addSpecialPattern("<\!--.*?-->", $mode, - 'plugin_htmlcomment'); + $this->Lexer->addSpecialPattern("<\!--.*?-->", $mode, 'plugin_htmlcomment'); + $this->Lexer->addSpecialPattern("%\!--.*?--%", $mode, 'plugin_htmlcomment'); + $this->Lexer->addSpecialPattern("
", $mode, 'plugin_htmlcomment'); } function handle($match, $state, $pos, &$handler) { if ($state == DOKU_LEXER_SPECIAL) { - // strip from end - $match = substr($match,4,-3); - return array($state, $match); + if ($match == '
') + { + return array('newline',$match); + } + if (strpos($match, '%!--') !== false) + { + $state = 'displaycomment'; + } + // strip from end + $match = substr($match,4,-3); + return array($state, $match); } return array(); } @@ -57,14 +66,31 @@ function render($mode, &$renderer, $data) { if ($mode == 'xhtml') { list($state, $match) = $data; - if ($state == DOKU_LEXER_SPECIAL) { - $renderer->doc .= ''; + if ($state == 'newline') + { + $renderer->doc .= $match; + return true; + } + if ($state == 'displaycomment') + { + $renderer->doc .= '<!--'; + } + else + { + $renderer->doc .= ''; } return true; }