/** * 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 .= '<div class="plugin_include_content plugin_include__' . $page . '"' . $id . '>' . DOKU_LF; if (is_a($renderer, 'renderer_plugin_dw2pdf')) { $renderer->doc .= '<a name="' . $secid . '" />'; } break; case 'close': $renderer->finishSectionEdit(); $renderer->doc .= '</div>' . DOKU_LF; break; } return true; } return false; }
/** * Renders a permalink header. * * Code heavily copied from the header renderer from inc/parser/xhtml.php, just * added an href parameter to the anchor tag linking to the wikilink. */ function render($mode, Doku_Renderer $renderer, $data) { global $conf; list($headline, $lvl, $pos, $page, $sect, $flags) = $data; if ($mode == 'xhtml') { /** @var Doku_Renderer_xhtml $renderer */ $hid = $renderer->_headerToLink($headline, true); $renderer->toc_additem($hid, $headline, $lvl); $url = $sect ? wl($page) . '#' . $sect : wl($page); $renderer->doc .= DOKU_LF . '<h' . $lvl; $classes = array(); if ($flags['taglogos']) { $tag = $this->_get_firsttag($page); if ($tag) { $classes[] = 'include_firsttag__' . $tag; } } // the include header instruction is always at the beginning of the first section edit inside the include // wrap so there is no need to close a previous section edit. if ($lvl <= $conf['maxseclevel']) { $classes[] = $renderer->startSectionEdit($pos, 'section', $headline); } if ($classes) { $renderer->doc .= ' class="' . implode(' ', $classes) . '"'; } $headline = $renderer->_xmlEntities($headline); $renderer->doc .= ' id="' . $hid . '"><a href="' . $url . '" title="' . $headline . '">'; $renderer->doc .= $headline; $renderer->doc .= '</a></h' . $lvl . '>' . DOKU_LF; return true; } else { $renderer->header($headline, $lvl, $pos); } return false; }
/** * Renders an include edit button * * @author Michael Klier <*****@*****.**> */ function render($mode, Doku_Renderer &$renderer, $data) { list($title) = $data; if ($mode == 'xhtml') { $renderer->startSectionEdit(0, 'plugin_include_editbtn', $title); $renderer->finishSectionEdit(); return true; } return false; }
/** * Create output */ function render($mode, Doku_Renderer $renderer, $indata) { if (empty($indata)) { return false; } list($state, $data) = $indata; if ($mode == 'xhtml') { /** @var Doku_Renderer_xhtml $renderer */ switch ($state) { case DOKU_LEXER_ENTER: // add a section edit right at the beginning of the wrap output $renderer->startSectionEdit(0, 'plugin_wrap_start'); $renderer->finishSectionEdit(); // add a section edit for the end of the wrap output. This prevents the renderer // from closing the last section edit so the next section button after the wrap syntax will // include the whole wrap syntax $renderer->startSectionEdit(0, 'plugin_wrap_end'); $wrap =& plugin_load('helper', 'wrap'); $attr = $wrap->buildAttributes($data, 'plugin_wrap'); $renderer->doc .= '<div' . $attr . '>'; break; case DOKU_LEXER_EXIT: $renderer->doc .= "</div>"; $renderer->finishSectionEdit(); break; } return true; } return false; }
/** * Create output */ function render($mode, Doku_Renderer $renderer, $indata) { static $type_stack = array (); if (empty($indata)) return false; list($state, $data) = $indata; if($mode == 'xhtml'){ /** @var Doku_Renderer_xhtml $renderer */ switch ($state) { case DOKU_LEXER_ENTER: // add a section edit right at the beginning of the wrap output $renderer->startSectionEdit(0, 'plugin_wrap_start'); $renderer->finishSectionEdit(); // add a section edit for the end of the wrap output. This prevents the renderer // from closing the last section edit so the next section button after the wrap syntax will // include the whole wrap syntax $renderer->startSectionEdit(0, 'plugin_wrap_end'); case DOKU_LEXER_SPECIAL: $wrap = $this->loadHelper('wrap'); $attr = $wrap->buildAttributes($data, 'plugin_wrap'); $renderer->doc .= '<div'.$attr.'>'; if ($state == DOKU_LEXER_SPECIAL) $renderer->doc .= '</div>'; break; case DOKU_LEXER_EXIT: $renderer->doc .= '</div>'; $renderer->finishSectionEdit(); break; } return true; } if($mode == 'odt'){ switch ($state) { case DOKU_LEXER_ENTER: $wrap = plugin_load('helper', 'wrap'); array_push ($type_stack, $wrap->renderODTElementOpen($renderer, 'div', $data)); break; case DOKU_LEXER_EXIT: $element = array_pop ($type_stack); $wrap = plugin_load('helper', 'wrap'); $wrap->renderODTElementClose ($renderer, $element); break; } return true; } return false; }