1<?php 2/** 3 * Mikio Syntax Plugin: Badge 4 * 5 * Syntax: <BADGE [primary|secondary|success|danger|warning|info|light|dark] [pill]></BADGE> 6 * 7 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 8 * @author James Collins <james.collins@outlook.com.au> 9 */ 10 11if (!defined('DOKU_INC')) die(); 12if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 13require_once(dirname(__FILE__).'/core.php'); 14 15class syntax_plugin_mikioplugin_badge extends syntax_plugin_mikioplugin_core { 16 public $tag = 'badge'; 17 public $defaults = array('type' => 'primary'); 18 public $options = array( 19 'type' => array('primary', 'secondary', 'success', 'danger', 'warning', 'info', 'light', 'dark'), 20 'pill' 21 ); 22 23 24 public function render_lexer_enter(Doku_Renderer $renderer, $data) { 25 $classes = $this->buildClassString($data, array('type', 'pill'), 'badge-'); 26 27 $renderer->doc .= '<span class="badge ' . $classes . '">'; 28 } 29 30 31 public function render_lexer_exit(Doku_Renderer $renderer, $data) { 32 $renderer->doc .= '</span>'; 33 } 34} 35?>