xref: /dokuwiki/inc/parser/renderer.php (revision a6858c6a90527664406b82e32fcf457628700df1)
1<?php
2/**
3 * Renderer output base class
4 *
5 * @author Harry Fuecks <hfuecks@gmail.com>
6 * @author Andreas Gohr <andi@splitbrain.org>
7 */
8if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');
9
10require_once DOKU_INC . 'inc/parser/renderer.php';
11require_once DOKU_INC . 'inc/pluginutils.php';
12
13class Doku_Renderer {
14    var $info = array(
15        'cache' => TRUE, // may the rendered result cached?
16        'toc'   => TRUE, // render the TOC?
17    );
18
19
20    function nocache() {
21        $this->info['cache'] = FALSE;
22    }
23
24    function notoc() {
25        $this->info['toc'] = FALSE;
26    }
27
28    //handle plugin rendering
29    function plugin($name,$data){
30        $plugin =& plugin_load('syntax',$name);
31        if($plugin != null){
32            // determine mode from renderer class name - format = "Doku_Renderer_<mode>"
33            $mode = substr(get_class($this), 14);
34            $plugin->render($mode,$this,$data);
35        }
36    }
37
38    /**
39     * handle nested render instructions
40     * this method (and nest_close method) should not be overloaded in actual renderer output classes
41     */
42    function nest($instructions) {
43
44      foreach ( $instructions as $instruction ) {
45        // execute the callback against ourself
46        call_user_func_array(array(&$this, $instruction[0]),$instruction[1]);
47      }
48    }
49
50    // dummy closing instruction issued by Doku_Handler_Nest, normally the syntax mode should
51    // override this instruction when instantiating Doku_Handler_Nest - however plugins will not
52    // be able to - as their instructions require data.
53    function nest_close() {}
54
55    function document_start() {}
56
57    function document_end() {}
58
59    function render_TOC() { return ''; }
60
61    function header($text, $level, $pos) {}
62
63    function section_edit($start, $end, $level, $name) {}
64
65    function section_open($level) {}
66
67    function section_close() {}
68
69    function cdata($text) {}
70
71    function p_open() {}
72
73    function p_close() {}
74
75    function linebreak() {}
76
77    function hr() {}
78
79    function strong_open() {}
80
81    function strong_close() {}
82
83    function emphasis_open() {}
84
85    function emphasis_close() {}
86
87    function underline_open() {}
88
89    function underline_close() {}
90
91    function monospace_open() {}
92
93    function monospace_close() {}
94
95    function subscript_open() {}
96
97    function subscript_close() {}
98
99    function superscript_open() {}
100
101    function superscript_close() {}
102
103    function deleted_open() {}
104
105    function deleted_close() {}
106
107    function footnote_open() {}
108
109    function footnote_close() {}
110
111    function listu_open() {}
112
113    function listu_close() {}
114
115    function listo_open() {}
116
117    function listo_close() {}
118
119    function listitem_open($level) {}
120
121    function listitem_close() {}
122
123    function listcontent_open() {}
124
125    function listcontent_close() {}
126
127    function unformatted($text) {}
128
129    function php($text) {}
130
131    function html($text) {}
132
133    function preformatted($text) {}
134
135    function file($text) {}
136
137    function quote_open() {}
138
139    function quote_close() {}
140
141    function code($text, $lang = NULL) {}
142
143    function acronym($acronym) {}
144
145    function smiley($smiley) {}
146
147    function wordblock($word) {}
148
149    function entity($entity) {}
150
151    // 640x480 ($x=640, $y=480)
152    function multiplyentity($x, $y) {}
153
154    function singlequoteopening() {}
155
156    function singlequoteclosing() {}
157
158    function doublequoteopening() {}
159
160    function doublequoteclosing() {}
161
162    // $link like 'SomePage'
163    function camelcaselink($link) {}
164
165    // $link like 'wiki:syntax', $title could be an array (media)
166    function internallink($link, $title = NULL) {}
167
168    // $link is full URL with scheme, $title could be an array (media)
169    function externallink($link, $title = NULL) {}
170
171    // $link is the original link - probably not much use
172    // $wikiName is an indentifier for the wiki
173    // $wikiUri is the URL fragment to append to some known URL
174    function interwikilink($link, $title = NULL, $wikiName, $wikiUri) {}
175
176    // Link to file on users OS, $title could be an array (media)
177    function filelink($link, $title = NULL) {}
178
179    // Link to a Windows share, , $title could be an array (media)
180    function windowssharelink($link, $title = NULL) {}
181
182//  function email($address, $title = NULL) {}
183    function emaillink($address, $name = NULL) {}
184
185    function internalmedialink (
186        $src,$title=NULL,$align=NULL,$width=NULL,$height=NULL,$cache=NULL
187        ) {}
188
189    function externalmedialink(
190        $src,$title=NULL,$align=NULL,$width=NULL,$height=NULL,$cache=NULL
191        ) {}
192
193    function table_open($maxcols = NULL, $numrows = NULL){}
194
195    function table_close(){}
196
197    function tablerow_open(){}
198
199    function tablerow_close(){}
200
201    function tableheader_open($colspan = 1, $align = NULL){}
202
203    function tableheader_close(){}
204
205    function tablecell_open($colspan = 1, $align = NULL){}
206
207    function tablecell_close(){}
208
209}
210
211
212//Setup VIM: ex: et ts=4 enc=utf-8 :
213