1<?php 2/** 3 * Mikio Syntax Plugin: HR 4 * 5 * Syntax: ---- or <HR> will be replaced with the horizontal line element 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/'); 13 14 15class syntax_plugin_mikioplugin_hr extends DokuWiki_Syntax_Plugin { 16 public function getType(){ return 'substition'; } 17 public function getAllowedTypes() { return array('formatting', 'substition', 'disabled'); } 18 public function getSort(){ return 238; } 19 20 21 public function connectTo($mode) { 22 $this->Lexer->addSpecialPattern('----', $mode, 'plugin_mikioplugin_'.$this->getPluginComponent()); 23 $this->Lexer->addSpecialPattern('<hr>', $mode, 'plugin_mikioplugin_'.$this->getPluginComponent()); 24 } 25 26 27 public function handle($match, $state, $pos, Doku_Handler $handler){ 28 return array($match, $state, $pos); 29 } 30 31 32 public function render($mode, Doku_Renderer $renderer, $data) { 33 if($mode == 'xhtml') { 34 $renderer->doc .= '<hr>'; 35 return true; 36 } 37 38 return false; 39 } 40}