Skip to content

Commit

Permalink
Merge pull request #224 from dokufreaks/secedit_greebo
Browse files Browse the repository at this point in the history
Compatibility with new section editing in DokuWiki Greebo, fix #223
  • Loading branch information
michitux committed Apr 17, 2018
2 parents 9b33049 + 9986c3a commit de79031
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
7 changes: 6 additions & 1 deletion syntax/editbtn.php
Expand Up @@ -34,7 +34,12 @@ function handle($match, $state, $pos, Doku_Handler $handler) {
function render($mode, Doku_Renderer $renderer, $data) {
list($title) = $data;
if ($mode == 'xhtml') {
$renderer->startSectionEdit(0, 'plugin_include_editbtn', $title);
if (defined('SEC_EDIT_PATTERN')) { // for DokuWiki Greebo and more recent versions
$renderer->startSectionEdit(0, array('target' => 'plugin_include_editbtn', 'name' => $title));
} else {
$renderer->startSectionEdit(0, 'plugin_include_editbtn', $title);
}

$renderer->finishSectionEdit();
return true;
}
Expand Down
6 changes: 5 additions & 1 deletion syntax/header.php
Expand Up @@ -56,7 +56,11 @@ function render($mode, Doku_Renderer $renderer, $data) {
// 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 (defined('SEC_EDIT_PATTERN')) { // for DokuWiki Greebo and more recent versions
$classes[] = $renderer->startSectionEdit($pos, array('target' => 'section', 'name' => $headline, 'hid' => $hid));
} else {
$classes[] = $renderer->startSectionEdit($pos, 'section', $headline);
}
}
if ($classes) {
$renderer->doc .= ' class="'. implode(' ', $classes) . '"';
Expand Down
18 changes: 15 additions & 3 deletions syntax/wrap.php
Expand Up @@ -36,14 +36,26 @@ function render($mode, Doku_Renderer $renderer, $data) {
switch($state) {
case 'open':
if ($redirect) {
$renderer->startSectionEdit(0, 'plugin_include_start', $page);
if (defined('SEC_EDIT_PATTERN')) { // for DokuWiki Greebo and more recent versions
$renderer->startSectionEdit(0, array('target' => 'plugin_include_start', 'name' => $page));
} else {
$renderer->startSectionEdit(0, 'plugin_include_start', $page);
}
} else {
$renderer->startSectionEdit(0, 'plugin_include_start_noredirect', $page);
if (defined('SEC_EDIT_PATTERN')) { // for DokuWiki Greebo and more recent versions
$renderer->startSectionEdit(0, array('target' => 'plugin_include_start_noredirect', 'name' => $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 (defined('SEC_EDIT_PATTERN')) { // for DokuWiki Greebo and more recent versions
$renderer->startSectionEdit(0, array('target' => 'plugin_include_end', 'name' => $page));
} else {
$renderer->startSectionEdit(0, 'plugin_include_end', $page);
}
if ($secid === NULL) {
$id = '';
} else {
Expand Down

0 comments on commit de79031

Please sign in to comment.