1<?php 2if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); 3if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 4require_once(DOKU_PLUGIN.'syntax.php'); 5require_once(__DIR__. '/../common.php'); 6 7class syntax_plugin_confightmlok_htmlblock extends HtmlOK_addendum { 8 9 //function getType() { return 'disabled'; } 10 //function getPType() { return 'normal'; } 11 //function getAllowedTypes() { return array('disabled'); } 12 13 function connectTo ($mode) { 14 $this->Lexer->addEntryPattern('<HTML>(?=.*</HTML>)', $mode, 'plugin_confightmlok_htmlblock'); 15 } 16 17 function postConnect () { 18 $this->Lexer->addExitPattern('</HTML>', 'plugin_confightmlok_htmlblock'); 19 } 20 21 function render($mode, Doku_Renderer $renderer, $data) { 22 list ($state, $match) = $data; 23 $wrapper= 'pre'; 24 switch ($state) { 25 case DOKU_LEXER_ENTER : 26 break; 27 28 //case DOKU_LEXER_UNMATCHED : 29 case DOKU_LEXER_UNMATCHED : 30 if ($this->htmlok_but_truly_ok()) { 31 $renderer->doc .= '<div>'. $match. '</div>'; 32 } else { 33 // should be html2text($match) 34 $renderer->doc .= p_xhtml_cached_geshi($match, 'html4strict', $wrapper); 35 } 36 break; 37 38 case DOKU_LEXER_EXIT: 39 //$renderer->doc.= "~3$match~"; 40 break; 41 42 } 43 return true; 44 } 45} 46