1<?php
2
3class Text_Wiki_Render_Creole_List extends Text_Wiki_Render {
4
5    /**
6    *
7    * Renders a token into text matching the requested format.
8    *
9    * This rendering method is syntactically and semantically compliant
10    * with XHTML 1.1 in that sub-lists are part of the previous list item.
11    *
12    * @access public
13    *
14    * @param array $options The "options" portion of the token (second
15    * element).
16    *
17    * @return string The text rendered from the token options.
18    *
19    */
20
21    function token($options)
22    {
23        // make nice variables (type, level, count)
24
25        switch ($options['type']) {
26
27        case 'bullet_list_start':
28        case 'number_list_start':
29            return '';
30            break;
31        case 'bullet_list_end':
32        case 'number_list_end':
33            if ($options['level'] == 0) {
34                return "\n";
35            }
36            break;
37        case 'bullet_item_start':
38            $pad = str_pad('', $options['level'], '*');
39            return $pad . ' ';
40            break;
41        case 'number_item_start':
42            $pad = str_pad('', $options['level'], '#');
43            return $pad . ' ';
44            break;
45        case 'bullet_item_end':
46        case 'number_item_end':
47        default:
48            return "\n";
49            break;
50        }
51    }
52}
53?>