diff options
Diffstat (limited to 'platform/www/lib/plugins/markdowku/syntax/codespans2.php')
-rw-r--r-- | platform/www/lib/plugins/markdowku/syntax/codespans2.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/platform/www/lib/plugins/markdowku/syntax/codespans2.php b/platform/www/lib/plugins/markdowku/syntax/codespans2.php new file mode 100644 index 0000000..596fc28 --- /dev/null +++ b/platform/www/lib/plugins/markdowku/syntax/codespans2.php @@ -0,0 +1,34 @@ +<?php +/* + * Codespans enclosed with two backticks: ``...`` + */ + +if(!defined('DOKU_INC')) die(); +if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); +require_once(DOKU_PLUGIN.'syntax.php'); + +class syntax_plugin_markdowku_codespans2 extends DokuWiki_Syntax_Plugin { + + function getType() { return 'formatting'; } + function getPType() { return 'normal'; } + function getSort() { return 98; } + + function connectTo($mode) { + $this->Lexer->addSpecialPattern( + '(?<!`)``(?!`).+?(?<!`)``(?!`)', + $mode, + 'plugin_markdowku_codespans2'); + } + + function handle($match, $state, $pos, Doku_Handler $handler) { + return array($match); + } + + function render($mode, Doku_Renderer $renderer, $data) { + $renderer->monospace_open(); + $renderer->cdata(substr($data[0], 2, -2)); + $renderer->monospace_close(); + return true; + } +} +//Setup VIM: ex: et ts=4 enc=utf-8 : |