Skip to content

Commit de79031

Browse files
authored
Merge pull request #224 from dokufreaks/secedit_greebo
Compatibility with new section editing in DokuWiki Greebo, fix #223
2 parents 9b33049 + 9986c3a commit de79031

3 files changed

Lines changed: 26 additions & 5 deletions

File tree

syntax/editbtn.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,12 @@ function handle($match, $state, $pos, Doku_Handler $handler) {
3434
function render($mode, Doku_Renderer $renderer, $data) {
3535
list($title) = $data;
3636
if ($mode == 'xhtml') {
37-
$renderer->startSectionEdit(0, 'plugin_include_editbtn', $title);
37+
if (defined('SEC_EDIT_PATTERN')) { // for DokuWiki Greebo and more recent versions
38+
$renderer->startSectionEdit(0, array('target' => 'plugin_include_editbtn', 'name' => $title));
39+
} else {
40+
$renderer->startSectionEdit(0, 'plugin_include_editbtn', $title);
41+
}
42+
3843
$renderer->finishSectionEdit();
3944
return true;
4045
}

syntax/header.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@ function render($mode, Doku_Renderer $renderer, $data) {
5656
// the include header instruction is always at the beginning of the first section edit inside the include
5757
// wrap so there is no need to close a previous section edit.
5858
if ($lvl <= $conf['maxseclevel']) {
59-
$classes[] = $renderer->startSectionEdit($pos, 'section', $headline);
59+
if (defined('SEC_EDIT_PATTERN')) { // for DokuWiki Greebo and more recent versions
60+
$classes[] = $renderer->startSectionEdit($pos, array('target' => 'section', 'name' => $headline, 'hid' => $hid));
61+
} else {
62+
$classes[] = $renderer->startSectionEdit($pos, 'section', $headline);
63+
}
6064
}
6165
if ($classes) {
6266
$renderer->doc .= ' class="'. implode(' ', $classes) . '"';

syntax/wrap.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,26 @@ function render($mode, Doku_Renderer $renderer, $data) {
3636
switch($state) {
3737
case 'open':
3838
if ($redirect) {
39-
$renderer->startSectionEdit(0, 'plugin_include_start', $page);
39+
if (defined('SEC_EDIT_PATTERN')) { // for DokuWiki Greebo and more recent versions
40+
$renderer->startSectionEdit(0, array('target' => 'plugin_include_start', 'name' => $page));
41+
} else {
42+
$renderer->startSectionEdit(0, 'plugin_include_start', $page);
43+
}
4044
} else {
41-
$renderer->startSectionEdit(0, 'plugin_include_start_noredirect', $page);
45+
if (defined('SEC_EDIT_PATTERN')) { // for DokuWiki Greebo and more recent versions
46+
$renderer->startSectionEdit(0, array('target' => 'plugin_include_start_noredirect', 'name' => $page));
47+
} else {
48+
$renderer->startSectionEdit(0, 'plugin_include_start_noredirect', $page);
49+
}
4250
}
4351
$renderer->finishSectionEdit();
4452
// Start a new section with type != section so headers in the included page
4553
// won't print section edit buttons of the parent page
46-
$renderer->startSectionEdit(0, 'plugin_include_end', $page);
54+
if (defined('SEC_EDIT_PATTERN')) { // for DokuWiki Greebo and more recent versions
55+
$renderer->startSectionEdit(0, array('target' => 'plugin_include_end', 'name' => $page));
56+
} else {
57+
$renderer->startSectionEdit(0, 'plugin_include_end', $page);
58+
}
4759
if ($secid === NULL) {
4860
$id = '';
4961
} else {

0 commit comments

Comments
 (0)