1<?php 2/** 3 * Mikio Syntax Plugin: Text 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 */ 9if (!defined('DOKU_INC')) die(); 10if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 11require_once(dirname(__FILE__).'/core.php'); 12 13class syntax_plugin_mikioplugin_color extends syntax_plugin_mikioplugin_core { 14 public $tag = 'text'; 15 public $hasEndTag = true; 16 public $options = array( 17 'color' => array('type' => 'color', 'default' => ''), 18 'size' => array('type' => 'size', 'default' => ''), 19 'weight' => array('type' => 'choice', 20 'data' => array('normal', 'bold', 'bolder', 'lighter', '100', '200', '300', '400', '500', '600', '700', '800', '900', 'initial', 'inherit'), 21 'default' => 'normal'), 22 'style' => array('type' => 'text', 'default' => ''), 23 'background-color' => array('type' => 'color', 'default' => ''), 24 'line-height' => array('type' => 'float', 'default' => ''), 25 'text-decoration' => array('type' => 'text', 'default' => '1') 26 ); 27 28 public function getAllowedTypes() { return array('formatting', 'substition', 'disabled'); } 29 public function getPType() { return 'normal'; } 30 31 public function render_lexer_enter(Doku_Renderer $renderer, $data) { 32 33 $styles = $this->buildStyle(array( 34 'color' => $data['color'], 35 'font-size' => $data['size'], 36 'font-weight' => $data['weight'], 37 'font-style' => $data['style'], 38 'background-color' => $data['background-color'], 39 'line-height' => $data['line-height'], 40 'text-decoration' => $data['text-decoration'], 41 ), TRUE); 42 43 $renderer->doc .= '<span' . $styles . '>'; 44 } 45 46 47 public function render_lexer_exit(Doku_Renderer $renderer, $data) { 48 $renderer->doc .= '</span>'; 49 } 50} 51 52?>