summaryrefslogtreecommitdiff
path: root/syntax.php
diff options
context:
space:
mode:
authorYves Fischer <yvesf-git@xapek.org>2011-10-22 00:17:10 +0200
committerYves Fischer <yvesf-git@xapek.org>2011-10-22 00:17:10 +0200
commiteccaa6b2507b4217809b2cd955c0014bd043fe59 (patch)
tree5075f9d3d9749e8e63a8e5e626307c8146e146a0 /syntax.php
parentca0645e63d39c8cb67423ef76f0415fc09d2aca4 (diff)
downloaddokuwiki-plugin-treenav-eccaa6b2507b4217809b2cd955c0014bd043fe59.tar.gz
dokuwiki-plugin-treenav-eccaa6b2507b4217809b2cd955c0014bd043fe59.zip
caching, fix setting of metadata in syntax plugin
Diffstat (limited to 'syntax.php')
-rw-r--r--syntax.php17
1 files changed, 8 insertions, 9 deletions
diff --git a/syntax.php b/syntax.php
index fc6f648..779b40d 100644
--- a/syntax.php
+++ b/syntax.php
@@ -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: */