xref: /plugin/mikioplugin/syntax/icon.php (revision c3cafd3e9b083aec5e9d8567a3c1263f2373f0fe)
1<?php
2/**
3 * Mikio Syntax Plugin: Icon
4 *
5 * Syntax:  <ICON>
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_icon extends syntax_plugin_mikioplugin_core {
16    public $tag                 = 'icon';
17    public $noEndTag            = true;
18    public $privateOptions      = true;
19
20
21    public function render_lexer_special(Doku_Renderer $renderer, $data) {
22
23        $icon = $this->getFirstArrayKey($data);
24
25        if(is_string($icon)) {
26            if(substr($icon, 0, 3) != 'fa-') $icon = 'fa-' . $icon;
27        } else {
28            $icon = '';
29        }
30
31        $renderer->doc .= '<i class="fa ' . $icon . '"></i>';
32    }
33}
34?>