text-- * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) * @author Esther Brunner */ // must be run within Dokuwiki if(!defined('DOKU_INC')) die(); if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); require_once(DOKU_PLUGIN.'syntax.php'); /** * All DokuWiki plugins to extend the parser/rendering mechanism * need to inherit from this class */ class syntax_plugin_changemarks_deleted extends DokuWiki_Syntax_Plugin { var $ins = 'plugin_changemarks_deleted'; // instruction of this plugin static protected $helper = NULL; function getType() { return 'formatting'; } function getSort() { return 122; } function connectTo($mode) { $this->Lexer->addEntryPattern('(?=.*?)', $mode, $this->ins); $this->Lexer->addEntryPattern('\-\-[^\r\n]*?>(?=.*?\-\-)', $mode, $this->ins); } function postConnect() { $this->Lexer->addExitPattern('\-\-', $this->ins); $this->Lexer->addExitPattern('', $this->ins); } /** * Handle the match */ function handle($match, $state, $pos, Doku_Handler $handler) { switch ($state) { // entry pattern with optional title case DOKU_LEXER_ENTER: // strip markup if (substr($match, 0, 4) == 'doc .= ''; return true; case DOKU_LEXER_UNMATCHED: $renderer->doc .= hsc($data[1]); return true; case DOKU_LEXER_EXIT: $renderer->doc .= ''; return true; default: return false; } } if ($mode == 'odt') { if ($this->helper==NULL) { $this->helper = plugin_load('helper', 'changemarks'); } switch ($data[0]) { case DOKU_LEXER_ENTER: $title = ($data[1] ? ' title="'.hsc($data[1]).'"' : ''); if (class_exists('ODTDocument')) { $renderer->_odtSpanOpenUseCSS ('del'); } return true; case DOKU_LEXER_UNMATCHED: $renderer->cdata($data[1]); return true; case DOKU_LEXER_EXIT: if (class_exists('ODTDocument')) { $renderer->_odtSpanClose(); } return true; default: return false; } } } return false; } } // vim:ts=4:sw=4:et:enc=utf-8: