1: <?php
2: /**
3: * Renders a table of contents for a Wiki page.
4: *
5: * Copyright 2011-2012 Horde LLC (http://www.horde.org/)
6: *
7: * See the enclosed file COPYING for license information (GPLv2). If
8: * you did not receive this file, see
9: * http://www.horde.org/licenses/gpl
10: *
11: * PHP version 5
12: *
13: * @category Horde
14: * @package Wicked
15: * @author Gunnar Wrobel <wrobel@pardus.de>
16: * @link http://www.horde.org/apps/wicked
17: * @license http://www.horde.org/licenses/gpl GNU General Public License, version 2
18: */
19:
20: /**
21: * Renders a table of contents for a Wiki page.
22: *
23: * @category Horde
24: * @package Wicked
25: * @author Gunnar Wrobel <wrobel@pardus.de>
26: * @link http://www.horde.org/apps/wicked
27: * @license http://www.horde.org/licenses/gpl GNU General Public License, version 2
28: */
29: class Text_Wiki_Render_Rst_Toc2 extends Text_Wiki_Render
30: {
31: /**
32: * Renders a token into text matching the requested format.
33: *
34: * @param array $options The "options" portion of the token (second
35: * element).
36: *
37: * @return string The text rendered from the token options.
38: */
39: public function token($options)
40: {
41: if($options['type'] == 'list_start') {
42: return ".. contents:: Contents\n.. section-numbering::";
43: }
44: if($options['type'] == 'item_start') {
45: $this->wiki->registerRenderCallback(array($this, 'purge'));
46: }
47: if($options['type'] == 'item_end') {
48: $this->wiki->popRenderCallback();
49: }
50: return '';
51: }
52:
53: public function purge($block)
54: {
55: return '';
56: }
57: }
58: