diff options
Diffstat (limited to 'syntax.php')
-rw-r--r-- | syntax.php | 17 |
1 files changed, 8 insertions, 9 deletions
@@ -8,11 +8,11 @@ if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); require_once DOKU_PLUGIN.'syntax.php'; class syntax_plugin_treenav extends DokuWiki_Syntax_Plugin { - private $keys = array("icon", "title"); + private $keys = array('icon', 'title'); function getType() { return 'baseonly'; } function getSort() { return 32; } - + function connectTo($mode) { foreach ($this->keys as $key) { $this->Lexer->addSpecialPattern('~~'.$key.':.*?~~',$mode,'plugin_treenav'); @@ -25,17 +25,16 @@ class syntax_plugin_treenav extends DokuWiki_Syntax_Plugin { $match = substr($match, 2, -2); @list($key, $value) = explode(':', $match, 2); if (in_array($key, $this->keys)) { - $this->setMetadata($key, $value); + return array($key, $value); } } } - - function setMetadata($key, $value) { - global $ID; - $data = p_get_metadata($ID, "treenav", false) or array(); - $data[$key] = $value; - return p_set_metadata($ID, array("treenav" => $data)); + function render($mode, &$renderer, $data) { + if ($mode === 'metadata') { + $renderer->meta['treenav'][$data[0]] = $data[1]; + } } + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |