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