* @author Michael Hamann */ if (!defined('DOKU_INC')) die('must be used inside DokuWiki'); class syntax_plugin_include_wrap extends DokuWiki_Syntax_Plugin { function getType() { return 'formatting'; } function getSort() { return 50; } function handle($match, $state, $pos, Doku_Handler $handler) { // this is a syntax plugin that doesn't offer any syntax, so there's nothing to handle by the parser } /** * Wraps the included page in a div and writes section edits for the action component * so it can detect where an included page starts/ends. * * @author Michael Klier * @author Michael Hamann */ function render($mode, Doku_Renderer $renderer, $data) { if ($mode == 'xhtml') { list($state, $page, $redirect, $secid) = $data; switch($state) { case 'open': if ($redirect) { $renderer->startSectionEdit(0, 'plugin_include_start', $page); } else { $renderer->startSectionEdit(0, 'plugin_include_start_noredirect', $page); } $renderer->finishSectionEdit(); // Start a new section with type != section so headers in the included page // won't print section edit buttons of the parent page $renderer->startSectionEdit(0, 'plugin_include_end', $page); if ($secid === NULL) { $id = ''; } else { $id = ' id="'.$secid.'"'; } $renderer->doc .= '
' . DOKU_LF; if (is_a($renderer,'renderer_plugin_dw2pdf')) { $renderer->doc .= ''; } break; case 'close': $renderer->finishSectionEdit(); $renderer->doc .= '
' . DOKU_LF; break; } return true; } return false; } } // vim:ts=4:sw=4:et: