-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathsyntax.php
More file actions
55 lines (47 loc) · 1.42 KB
/
syntax.php
File metadata and controls
55 lines (47 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
use dokuwiki\Extension\SyntaxPlugin;
/**
* S5 Plugin: Display a Wiki page as S5 slideshow presentation
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Andreas Gohr <andi@splitbrain.org>
*/
class syntax_plugin_s5 extends SyntaxPlugin
{
/** @inheritdoc */
public function getType()
{
return 'substition';
}
/** @inheritdoc */
public function getPType()
{
return 'normal';
}
/** @inheritdoc */
public function getSort()
{
return 800;
}
/** @inheritdoc */
public function connectTo($mode)
{
$this->Lexer->addSpecialPattern('~~SLIDESHOW[^~]*~~', $mode, 'plugin_s5');
}
/** @inheritdoc */
public function handle($match, $state, $pos, Doku_Handler $handler)
{
if ($match != '~~SLIDESHOW~~') return [trim(substr($match, 11, -2))];
return [];
}
/** @inheritdoc */
public function render($format, Doku_Renderer $renderer, $data)
{
global $ID;
if ($format != 'xhtml') return false;
$renderer->doc .= '<a href="' . exportlink($ID, 's5', count($data) ? ['s5theme' => $data[0]] : null) . '" title="' . $this->getLang('view') . '">';
$renderer->doc .= '<img src="' . DOKU_BASE . 'lib/plugins/s5/screen.gif" align="right" alt="' . $this->getLang('view') . '" width="48" height="48" />';
$renderer->doc .= '</a>';
return true;
}
}