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_htmlok_html 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_htmlok_html'); 15 } 16 17 function postConnect () { 18 $this->Lexer->addExitPattern('</html>', 'plugin_htmlok_html'); 19 } 20 21 function render ($mode, Doku_Renderer $renderer, $data) { 22 list ($state, $match) = $data; 23 switch ($state) { 24 case DOKU_LEXER_ENTER : 25 break; 26 27 case DOKU_LEXER_UNMATCHED : 28 if ($this->htmlok_but_truly_ok()) { 29 //if(in_array($mode, ['xhtml', 's5'], true)) { 30 $renderer->doc .= $match; 31 } else { 32 // should be html2text($match)? 33 $renderer->doc .= p_xhtml_cached_geshi($match, 'html4strict', 'code'); 34 } 35 break; 36 37 case DOKU_LEXER_EXIT: 38 break; 39 40 } 41 return true; 42 } 43} 44