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