1<?php
2/**
3 * Renderer for XHTML output
4 *
5 * @author Harry Fuecks <hfuecks@gmail.com>
6 * @author Andreas Gohr <andi@splitbrain.org>
7 */
8// must be run within Dokuwiki
9if(!defined('DOKU_INC')) die();
10if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/');
11
12// we inherit from the XHTML renderer instead directly of the base renderer
13require_once DOKU_INC.'inc/parser/xhtml.php';
14
15class renderer_plugin_impressjs extends Doku_Renderer_xhtml {
16    private $data_x = 0;
17    private $data_y = 0;
18    private $data_z = 0;
19    private $tpl;
20    private $base;
21
22    public function document_start(){
23        global $conf;
24        global $ID;
25
26        $this->base = DOKU_BASE.'lib/plugins/impressjs/tpl/';
27        $this->tpl  = $this->getConf('template');
28
29        $this->doc .= '<!DOCTYPE html>
30<html lang="'.$conf['lang'].'">
31<head>
32    <meta name="viewport" content="width=1024" />
33    <meta charset="utf-8" />
34    <title>'.tpl_pagetitle($ID, true).'</title>
35
36    <meta name="generator" content="impress.js" />
37    <meta name="version" content="impress.js ab44798b081997319f4207dabbb052736acfc512" />
38
39    <link rel="stylesheet" href="'.DOKU_BASE.'lib/styles/screen.css" type="text/css" media="screen" />
40    <link href="'.$this->base.$this->tpl.'/impress.css" rel="stylesheet" />
41    <link href="'.$this->base.$this->tpl.'/impress-extra.css" rel="stylesheet" />
42</head>
43<body>
44    <div id="impress">';
45    }
46
47    public function document_end(){
48        $this->doc .= '</div>
49        <script src="'.$this->base.$this->tpl.'/impress.js"></script>
50        <script>impress().init();</script></body></html>';
51    }
52    public function section_close() {
53        $this->doc .= "</div>";
54        parent::section_close();
55    }
56    public function header($text, $level, $pos) {
57        global $lang;
58
59        $this->data_x += $this->getConf('data-x');
60        $this->data_y += $this->getConf('data-y');
61        $this->data_z += $this->getConf('data-z');
62
63        $this->doc .= "<div class='".($level == 1 ? '' : 'slide ')."step' ";
64        $this->doc .= "data-x='$this->data_x' data-y='$this->data_y' data-z='$this->data_z' ";
65        $this->doc .= "dir='".$lang['direction']."' >";
66        $this->doc .= "<h$level>$text</h$level>";
67    }
68}
69