Commit | Line | Data |
---|---|---|
6855525e JL |
1 | <?php |
2 | ||
3 | ||
4 | class Text_Wiki_Render_Latex_List extends Text_Wiki_Render { | |
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 | extract($options); | |
25 | ||
26 | switch ($type) | |
27 | { | |
28 | case 'bullet_list_start': | |
29 | return "\\begin{itemize}\n"; | |
30 | ||
31 | case 'bullet_list_end': | |
32 | return "\\end{itemize}\n"; | |
33 | ||
34 | case 'number_list_start': | |
35 | return "\\begin{enumerate}\n"; | |
36 | ||
37 | case 'number_list_end': | |
38 | return "\\end{enumerate}\n"; | |
39 | ||
40 | case 'bullet_item_start': | |
41 | case 'number_item_start': | |
42 | return "\\item{"; | |
43 | ||
44 | case 'bullet_item_end': | |
45 | case 'number_item_end': | |
46 | return "}\n"; | |
47 | ||
48 | default: | |
49 | // ignore item endings and all other types. | |
50 | // item endings are taken care of by the other types | |
51 | // depending on their place in the list. | |
52 | return ''; | |
53 | break; | |
54 | } | |
55 | } | |
56 | } | |
57 | ?> |