====== Space Plugin ====== ---- plugin ---- description: Inserts 1 non-breaking spaced to 'force' a space (based on the tab plugin syntax) author : Gerardo Armendariz email : garmendariz@gmail.com type : syntax lastupdate : 2006-08-16 compatible : depends : conflicts : similar : tab, nbsp tags : space ---- ===== Description ===== This plugin is completely based on the [[plugin:tab|tab plugin]] syntax by Tim Skoch. It adds a single space to the page. ===== Use ===== Simply insert '' into the text. When DokuWiki parses it, it will replace '' with 1 nbsp's. ===== Code ===== it encounters * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) * @author Gerardo Armendariz based on Tim Skoch tab plugin. */ if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); require_once(DOKU_PLUGIN.'syntax.php'); /** * All DokuWiki plugins to extend the parser/rendering mechanism * need to inherit from this class */ class syntax_plugin_space extends DokuWiki_Syntax_Plugin { /** * return some info */ function getInfo(){ return array( 'author' => 'Gerardo Armendariz', 'email' => 'garmendariz@gmail.com', 'date' => '2008-11-20', 'name' => 'Space Plugin', 'desc' => 'Inserts " " into the HTML of the document for every it encounters', 'url' => 'http://www.dokuwiki.org/plugin:space', ); } /** * What kind of syntax are we? */ function getType(){ return 'substition'; } /** * What kind of syntax do we allow (optional) */ // function getAllowedTypes() { // return array(); // } /** * What about paragraphs? (optional) */ // function getPType(){ // return 'normal'; // } /** * Where to sort in? */ function getSort(){ return 999; } /** * Connect pattern to lexer */ function connectTo($mode) { $this->Lexer->addSpecialPattern('',$mode,'plugin_space'); // $this->Lexer->addEntryPattern('',$mode,'plugin_test'); } // function postConnect() { // $this->Lexer->addExitPattern('','plugin_test'); // } /** * Handle the match */ function handle($match, $state, $pos, &$handler){ switch ($state) { case DOKU_LEXER_ENTER : break; case DOKU_LEXER_MATCHED : break; case DOKU_LEXER_UNMATCHED : break; case DOKU_LEXER_EXIT : break; case DOKU_LEXER_SPECIAL : break; } return array(); } /** * Create output */ function render($mode, &$renderer, $data) { if($mode == 'xhtml'){ $renderer->doc .= " "; // ptype = 'normal' // $renderer->doc .= "

Hello World!

"; // ptype = 'block' return true; } return false; } } //Setup VIM: ex: et ts=4 enc=utf-8 : ?>