1<?php
2/**
3 * Mikio Syntax Plugin: Accordion Item
4 *
5 * @link        http://github.com/nomadjimbob/mikioplugin
6 * @license     GPL 2 (http://www.gnu.org/licenses/gpl.html)
7 * @author      James Collins <james.collins@outlook.com.au>
8 */
9
10if (!defined('DOKU_INC')) die();
11if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
12require_once(dirname(__FILE__).'/core.php');
13
14class syntax_plugin_mikioplugin_accordionitem extends syntax_plugin_mikioplugin_core {
15    public $tag                 = 'accordion-item';
16    public $hasEndTag           = true;
17    public $options             = array(
18        'title'         => array('type'     => 'text',      'default'   => ''),
19        'show'          => array('type'     => 'boolean',   'default'   => 'false'),
20    );
21
22    public function __construct() {
23        $this->addCommonOptions('type text-align');
24    }
25
26    public function getAllowedTypes() { return array('container', 'formatting', 'substition', 'disabled', 'paragraphs'); }
27
28    public function render_lexer_enter(Doku_Renderer $renderer, $data) {
29        $classes = $this->buildClass($data, array('show'));
30
31        $renderer->doc .= '<div class="' . $this->elemClass . ' ' . $this->classPrefix . 'accordian-item' . $classes . '"><a href="#" class="' . $this->elemClass . ' ' . $this->classPrefix . 'accordian-title">' . $data['title'] . '</a><div class="' . $this->elemClass . ' ' . $this->classPrefix . 'accordian-body">';
32    }
33
34
35    public function render_lexer_exit(Doku_Renderer $renderer, $data) {
36        $renderer->doc .= '</div></div>';
37    }
38}
39?>