1<?php
2/*
3 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
4 * @author     Ikuo Obataya (i.obataya[at]gmail.com)
5 */
6if(!defined('DOKU_INC')) die();
7if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
8@require_once(DOKU_PLUGIN.'syntax.php');
9/**
10 * Tab plugin
11 */
12class syntax_plugin_tabinclude_inline extends DokuWiki_Syntax_Plugin{
13    function __construct(){
14        $this->helper = plugin_load('helper','tabinclude');
15    }
16    function getType(){ return 'substition'; }
17    function getSort(){ return 158; }
18    function connectTo($mode){$this->Lexer->addSpecialPattern('\{\{tabinclude.+?[^}]*\}\}',$mode,'plugin_tabinclude_inline');}
19
20    /**
21     * handle syntax
22     */
23    function handle($match, $state, $pos, Doku_Handler $handler){
24        $match = substr($match,12,-2); // strip markup
25        return $this->helper->getTabPages($match); // inline mode
26    }
27
28    /**
29     * Render tab control
30     */
31    function render($mode, Doku_Renderer $renderer, $data) {
32        list($state, $tabs,$init_page_idx,$class) = $data;
33        if ($mode=='xhtml'){
34            $this->helper->renderTabsHtml($renderer,$tabs,$init_page_idx,$class);
35            return true;
36        }else if($mode=='odt'){
37            $this->helper->getOdtHtml($renderer,$tabs);
38            return true;
39        }
40        return false;
41    }
42}
43?>
44