1<?php 2/** 3 * Syntax Plugin Backlinks 4 * 5 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 6 * @author Michael Klier <chi@chimeric.de> 7 */ 8 9if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); 10if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 11require_once(DOKU_PLUGIN.'syntax.php'); 12if(!defined('DW_LF')) define('DW_LF',"\n"); 13 14/** 15 * All DokuWiki plugins to extend the parser/rendering mechanism 16 * need to inherit from this class 17 */ 18class syntax_plugin_clearfloat extends DokuWiki_Syntax_Plugin { 19 20 21 /** 22 * General Info 23 */ 24 function getInfo(){ 25 return array( 26 'author' => 'Michael Klier (chi)', 27 'email' => 'chi@chimeric.de', 28 'date' => '2006-05-08', 29 'name' => 'Clearfloat', 30 'desc' => 'Clears previous floats from images etc.', 31 'url' => 'http://www.chimeric.de/dokuwiki/plugins/clearfloat' 32 ); 33 } 34 35 /** 36 * Syntax Type 37 * 38 * Needs to return one of the mode types defined in $PARSER_MODES in parser.php 39 */ 40 function getType(){ return 'substition'; } 41 function getPType() { return 'block'; } 42 function getSort() { return 308; } 43 44 /** 45 * Connect pattern to lexer 46 */ 47 function connectTo($mode) { 48 $this->Lexer->addSpecialPattern('~~CLEARFLOAT~~',$mode,'plugin_clearfloat'); 49 } 50 51 /** 52 * Handler to prepare matched data for the rendering process 53 */ 54 function handle($match, $state, $pos, &$handler){ 55 return array(); 56 } 57 58 /** 59 * Handles the actual output creation. 60 */ 61 function render($mode, &$renderer, $data) { 62 global $ID; 63 64 if($mode == 'xhtml'){ 65 $renderer->doc .= '<div class="clearer"></div>'; 66 return true; 67 } 68 return false; 69 } 70 71} 72//Setup VIM: ex: et ts=4 enc=utf-8 : 73