Skip to content

Commit

Permalink
fix warnings if <doctoc> on page without navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
Klap-in committed Feb 7, 2024
1 parent 14376eb commit 2cecf54
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions syntax/toc.php
Expand Up @@ -217,6 +217,7 @@ public function render($format, Doku_Renderer $renderer, $options)
}
} else {
$pagedata = p_get_metadata($pageid, 'docnavigation');
//can be null if <doctoc> on page without navigation.
}

//check referer
Expand All @@ -229,14 +230,16 @@ public function render($format, Doku_Renderer $renderer, $options)
}

$previouspage = $pageid;
$nextpageid = $pagedata['next']['link'];
if (empty($nextpageid)) {
if (empty($pagedata['next']['link'])) {
$pageid = null;
} elseif ($options['hidepagelink'] ? isset($recursioncheck[$nextpageid]) : isset($list[$nextpageid])) {
msg(sprintf($this->getLang('recursionprevented'), $pageid, $nextpageid), -1);
$pageid = null;
} else {
$pageid = $nextpageid;
} else{
$nextpageid = $pagedata['next']['link'];
if ($options['hidepagelink'] ? isset($recursioncheck[$nextpageid]) : isset($list[$nextpageid])) {
msg(sprintf($this->getLang('recursionprevented'), $pageid, $nextpageid), -1);
$pageid = null;
} else {
$pageid = $nextpageid;
}
}
}

Expand Down

0 comments on commit 2cecf54

Please sign in to comment.