-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathaction.php
66 lines (63 loc) · 2.61 KB
/
action.php
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
56
57
58
59
60
61
62
63
64
65
66
<?php
/**
* DokuWiki Plugin caption (Action Component)
*
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
* @author Till Biskup <till@till-biskup.de>
*/
class action_plugin_caption extends DokuWiki_Action_Plugin {
public function register(Doku_Event_Handler $controller) {
$controller->register_hook("TOOLBAR_DEFINE", "AFTER", $this, "insert_button", array ());
}
/**
* Inserts a toolbar button
*/
public function insert_button(&$event, $param) {
$event->data[] = array (
'type' => 'picker',
'title' => $this->getLang('picker'),
'icon' => '../../plugins/caption/images/picker.png',
'class' => 'captionpicker',
'list' => array(
array(
'type' => 'format',
'title' => $this->getLang('figure'),
'icon' => '../../plugins/caption/images/fig.png',
'open' => '<figure fig_label>\n',
'sample' => '{{:img |title}}',
'close' => '\n<caption>caption</caption>\n</figure>',
),
array(
'type' => 'format',
'title' => $this->getLang('table'),
'icon' => '../../plugins/caption/images/tab.png',
'open' => '<table tab_label>\n<caption>caption</caption>\n',
'sample' => '^ Header1 ^ Header2 ^\n| foo | bar |\n',
'close' => '</table>',
),
array(
'type' => 'format',
'title' => $this->getLang('code'),
'icon' => '../../plugins/caption/images/code.png',
'open' => '<codeblock code_label>\n<caption>caption</caption>\n',
'sample' => '<code>\n...\n</code>\n',
'close' => '</codeblock>',
),
array(
'type' => 'format',
'title' => $this->getLang('file'),
'icon' => '../../plugins/caption/images/file.png',
'open' => '<fileblock file_label>\n<caption>caption</caption>\n',
'sample' => '<file "" foo.txt>\n...\n</file>\n',
'close' => '</fileblock>',
),
array(
'type' => 'insert',
'title' => $this->getLang('reference'),
'icon' => '../../plugins/caption/images/ref.png',
'insert' => '{{ref>label}}',
)
)
);
}
}