backup de julho
[h2N7SspZmY.git] / lib / plugins / s5 / renderer.php
blob9d8ed0f04f65eec251b0ffd6e2fddfb90a7dd9db
1 <?php
2 /**
3 * Renderer for XHTML output
5 * @author Harry Fuecks <hfuecks@gmail.com>
6 * @author Andreas Gohr <andi@splitbrain.org>
7 */
8 // must be run within Dokuwiki
9 if(!defined('DOKU_INC')) die();
11 // we inherit from the XHTML renderer instead directly of the base renderer
12 require_once DOKU_INC.'inc/parser/xhtml.php';
14 /**
15 * The Renderer
17 class renderer_plugin_s5 extends Doku_Renderer_xhtml {
18 var $slideopen = false;
19 var $base='';
20 var $tpl='';
22 /**
23 * the format we produce
25 function getFormat(){
26 // this should be 's5' usally, but we inherit from the xhtml renderer
27 // and produce XHTML as well, so we can gain magically compatibility
28 // by saying we're the 'xhtml' renderer here.
29 return 'xhtml';
33 /**
34 * Initialize the rendering
36 function document_start() {
37 global $ID;
39 // call the parent
40 parent::document_start();
42 // store the content type headers in metadata
43 $headers = array(
44 'Content-Type' => 'text/html; charset=utf-8'
46 p_set_metadata($ID,array('format' => array('s5' => $headers) ));
47 $this->base = DOKU_BASE.'lib/plugins/s5/ui/';
48 $this->tpl = $this->getConf('template');
51 /**
52 * Print the header of the page
54 * Gets called when the very first H1 header is discovered. It includes
55 * all the S5 CSS and JavaScript magic
57 function s5_init($title){
58 global $conf;
59 global $lang;
60 global $INFO;
61 global $ID;
63 //throw away any previous content
64 $this->doc = '
65 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
66 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
67 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="'.$conf['lang'].'"
68 lang="'.$conf['lang'].'" dir="'.$lang['direction'].'">
70 <head>
71 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
72 <title>'.hsc($title).'</title>
73 <!-- metadata -->
74 <meta name="generator" content="S5" />
75 <meta name="version" content="S5 1.1" />
76 <!-- configuration parameters -->
77 <meta name="defaultView" content="slideshow" />
78 <meta name="controlVis" content="hidden" />
79 <!-- style sheet links -->
80 <link rel="stylesheet" href="'.DOKU_BASE.'lib/styles/style.css" type="text/css" media="screen" />
81 <link rel="stylesheet" href="'.$this->base.$this->tpl.'/slides.css" type="text/css" media="projection" id="slideProj" />
82 <link rel="stylesheet" href="'.$this->base.'default/outline.css" type="text/css" media="screen" id="outlineStyle" />
83 <link rel="stylesheet" href="'.$this->base.'default/print.css" type="text/css" media="print" id="slidePrint" />
84 <link rel="stylesheet" href="'.$this->base.'default/opera.css" type="text/css" media="projection" id="operaFix" />
85 <!-- S5 JS -->
86 <script src="'.$this->base.'default/slides.js" type="text/javascript"></script>
87 </head>
88 <body>
89 <div class="layout">
90 <div id="controls"><!-- DO NOT EDIT --></div>
91 <div id="currentSlide"><!-- DO NOT EDIT --></div>
92 <div id="header"></div>
93 <div id="footer">
94 <h1>'.$ID.'</h1>
95 <h2>'.hsc($conf['title']).' &#8226; '.strftime($conf['dformat'],$INFO['lastmod']).'</h2>
96 </div>
98 </div>
99 <div class="presentation">
104 * Closes the document
106 function document_end(){
107 // we don't care for footnotes and toc
108 // but cleanup is nice
109 $this->doc = preg_replace('#<p>\s*</p>#','',$this->doc);
111 if($this->slideopen){
112 $this->doc .= '</div>'.DOKU_LF; //close previous slide
114 $this->doc .= '</div>
115 </body>
116 </html>';
120 * This is what creates new slides
122 * A new slide is started for each H2 header
124 function header($text, $level, $pos) {
125 if($level == 1){
126 if(!$this->slideopen){
127 $this->s5_init($text); // this is the first slide
128 $level = 2;
129 }else{
130 return;
134 if($level == 2){
135 if($this->slideopen){
136 $this->doc .= '</div>'.DOKU_LF; //close previous slide
138 $this->doc .= '<div class="slide">'.DOKU_LF;
139 $this->slideopen = true;
141 $this->doc .= '<h'.($level-1).'>';
142 $this->doc .= $this->_xmlEntities($text);
143 $this->doc .= '</h'.($level-1).'>'.DOKU_LF;
147 * Top-Level Sections are slides
149 function section_open($level) {
150 if($level < 3){
151 $this->doc .= '<div class="slidecontent">'.DOKU_LF;
152 }else{
153 $this->doc .= '<div>'.DOKU_LF;
155 // we don't use it
159 * Throw away footnote
161 function footnote_close() {
162 // recover footnote into the stack and restore old content
163 $footnote = $this->doc;
164 $this->doc = $this->store;
165 $this->store = '';
169 * No acronyms in a presentation
171 function acronym($acronym){
172 $this->doc .= $this->_xmlEntities($acronym);
176 * A line stops the slide and start the handout section
178 function hr() {
179 $this->doc .= '</div>'.DOKU_LF;
180 $this->doc .= '<div class="handout">'.DOKU_LF;
184 //Setup VIM: ex: et ts=4 enc=utf-8 :