1<?php 2/* 3 * Codespans enclosed with one backtick: `...` 4 */ 5 6if(!defined('DOKU_INC')) die(); 7if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 8require_once(DOKU_PLUGIN.'syntax.php'); 9 10class syntax_plugin_markdowku_codespans1 extends DokuWiki_Syntax_Plugin { 11 12 function getType() { return 'formatting'; } 13 function getPType() { return 'normal'; } 14 function getSort() { return 99; } 15 function getAllowedTypes() { return array(); } 16 17 function connectTo($mode) { 18 $this->Lexer->addSpecialPattern( 19 '(?<!`)`(?!`).+?(?<!`)`(?!`)', 20 $mode, 21 'plugin_markdowku_codespans1'); 22 } 23 24 function handle($match, $state, $pos, Doku_Handler $handler) { 25 return array($match); 26 } 27 28 function render($mode, Doku_Renderer $renderer, $data) { 29 $renderer->monospace_open(); 30 $renderer->cdata(substr($data[0], 1, -1)); 31 $renderer->monospace_close(); 32 return true; 33 } 34} 35//Setup VIM: ex: et ts=4 enc=utf-8 : 36