Skip to content

Commit

Permalink
refactor and removed unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
Klap-in committed Feb 7, 2024
1 parent 19fb30b commit 3790004
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 25 deletions.
14 changes: 9 additions & 5 deletions action.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,32 @@
* @author Gerrit Uitslag <klapinklapin@gmail.com>
*/

use dokuwiki\Extension\ActionPlugin;
use dokuwiki\Extension\Event;
use dokuwiki\Extension\EventHandler;

/**
* Add documentation navigation elements around page
*/
class action_plugin_docnavigation extends DokuWiki_Action_Plugin
class action_plugin_docnavigation extends ActionPlugin
{

/**
* Register the events
*
* @param Doku_Event_Handler $controller
* @param EventHandler $controller
*/
public function register(Doku_Event_Handler $controller)
public function register(EventHandler $controller)
{
$controller->register_hook('RENDERER_CONTENT_POSTPROCESS', 'AFTER', $this, 'addtopnavigation');
}

/**
* Add navigation bar to top of content
*
* @param Doku_Event $event
* @param Event $event
*/
public function addtopnavigation(Doku_Event $event)
public function addtopnavigation(Event $event)
{
global $ACT;

Expand Down
6 changes: 4 additions & 2 deletions syntax/pagenav.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
* @author Gerrit Uitslag <klapinklapin@gmail.com>
*/

use dokuwiki\Extension\SyntaxPlugin;

/**
* Handles document navigation syntax
*/
class syntax_plugin_docnavigation_pagenav extends DokuWiki_Syntax_Plugin
class syntax_plugin_docnavigation_pagenav extends SyntaxPlugin
{

/**
Expand Down Expand Up @@ -51,7 +53,7 @@ public function getType()
* 'stack' - Special case. Plugin wraps other paragraphs.
*
* @return string
* @see Doku_Handler_Block
* @see \dokuwiki\Parsing\Handler\Block
*
*/
public function getPType()
Expand Down
21 changes: 3 additions & 18 deletions syntax/toc.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
* @author Gerrit Uitslag <klapinklapin@gmail.com>
*/

use dokuwiki\Extension\SyntaxPlugin;

/**
* Syntax for including a table of content of bundle of pages linked by docnavigation
*/
class syntax_plugin_docnavigation_toc extends DokuWiki_Syntax_Plugin
class syntax_plugin_docnavigation_toc extends SyntaxPlugin
{

/**
Expand Down Expand Up @@ -277,23 +279,6 @@ public function listItemNavtoc($item)
return $ret;
}

/**
* Callback for html_buildlist
*
* @param array $item
* @return string html
*/
function html_list_toc($item)
{
if (isset($item['hid'])) {
$link = '#' . $item['hid'];
} else {
$link = $item['link'];
}

return '<a href="' . $link . '">' . hsc($item['title']) . '</a>';
}

/**
* Resolves given id against current page to full pageid, removes hash
*
Expand Down

0 comments on commit 3790004

Please sign in to comment.