1<?php 2/** 3 * DokuWiki Plugin latexcaption (Action Component) 4 * 5 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html 6 * @author Ben van Magill <ben.vanmagill16@gmail.com> 7 * @author Till Biskup <till@till-biskup> 8 */ 9 10 11class action_plugin_latexcaption extends \dokuwiki\Extension\ActionPlugin { 12 13 public function register(Doku_Event_Handler $controller) { 14 $controller->register_hook("TOOLBAR_DEFINE", "AFTER", $this, "insert_button", array ()); 15 } 16 17 /** 18 * Inserts a toolbar button 19 */ 20 public function insert_button(&$event, $param) { 21 $captiontag = $this->getConf('captiontag'); 22 $event->data[] = array ( 23 'type' => 'picker', 24 'title' => $this->getLang('latexcaption'), 25 'icon' => '../../plugins/latexcaption/images/picker.png', 26 'class' => 'captionpicker', 27 'list' => array( 28 array( 29 'type' => 'format', 30 'title' => $this->getLang('figure'), 31 'icon' => '../../plugins/latexcaption/images/fig.png', 32 'open' => '<figure center|fig_label>\n', 33 'sample' => '{{:img |title}}', 34 'close' => '\n<'.$captiontag.'>caption</'.$captiontag.'>\n</figure>', 35 ), 36 array( 37 'type' => 'format', 38 'title' => $this->getLang('table'), 39 'icon' => '../../plugins/latexcaption/images/tab.png', 40 'open' => '<table |tab_label>\n<'.$captiontag.'>caption</'.$captiontag.'>\n', 41 'sample' => '^ Header1 ^ Header2 ^\n| foo | bar |\n', 42 'close' => '</table>', 43 ), 44 array( 45 'type' => 'format', 46 'title' => $this->getLang('code'), 47 'icon' => '../../plugins/latexcaption/images/code.png', 48 'open' => '<codeblock |code_label>\n<'.$captiontag.'>caption</'.$captiontag.'>\n', 49 'sample' => '<code>\n...\n</code>\n', 50 'close' => '</codeblock>', 51 ), 52 array( 53 'type' => 'format', 54 'title' => $this->getLang('file'), 55 'icon' => '../../plugins/latexcaption/images/file.png', 56 'open' => '<fileblock |file_label>\n<'.$captiontag.'>caption</'.$captiontag.'>\n', 57 'sample' => '<file "" foo.txt>\n...\n</file>\n', 58 'close' => '</fileblock>', 59 ), 60 array( 61 'type' => 'insert', 62 'title' => $this->getLang('reference'), 63 'icon' => '../../plugins/latexcaption/images/ref.png', 64 'insert' => '{{ref>label}}', 65 ) 66 ) 67 ); 68 } 69} 70