DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:smaller

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
plugin:smaller [2005-10-05 09:55] – external edit 127.0.0.1plugin:smaller [2013-11-13 01:23] (current) – created Klap-in
Line 1: Line 1:
-====== Smaller Plugin ====== +Please refer to [[BBCode]] plugin, which makes diffent text sizes possible.
- +
-**Note:** This plugin will be discontinued. A [[plugin:BBCode]] plugin will be released soon making different text sizes possible. +
- +
-===== Description ===== +
- +
-With this [[plugins|plugin]] the [[syntax]] of [[DokuWiki]] is extended to allow text with smaller font size. The syntax to use this plugin is... +
- +
-  #-Smaller text-# +
- +
-You can see the plugin in action [[http://www.qwik.ch/playground|here]]. +
- +
-===== Plugin ===== +
- +
-Put the following PHP file in ''/lib/plugins/smaller/syntax.php''+
- +
-<code php> +
-<?php +
-/** +
- * Smaller Plugin: enables smaller text font size with syntax #-text-# +
- * +
- * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html) +
- * @author     Esther Brunner <esther [at] kaffeehaus [dot] ch> +
- */ +
-  +
-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_smaller extends DokuWiki_Syntax_Plugin { +
- +
-    /** +
-     * return some info +
-     */ +
-    function getInfo(){ +
-        return array( +
-            'author' => 'Esther Brunner', +
-            'email'  => 'esther@kaffeehaus.ch', +
-            'date'   => '2005-06-27', +
-            'name'   => 'Smaller Plugin', +
-            'desc'   => 'Enables smaller text', +
-            'url'    => 'http://www.dokuwiki.org/plugin:smaller', +
-        ); +
-    } +
- +
-    /** +
-     * Constructor - adds allowed modes +
-     */ +
-    function syntax_plugin_smaller(){ +
-        global $PARSER_MODES; +
-        $this->allowedModes = array_merge( +
-            $PARSER_MODES['formatting'], +
-            $PARSER_MODES['substition'], +
-            $PARSER_MODES['disabled'+
-        ); +
-    } +
-  +
-    /** +
-     * What kind of syntax are we? +
-     */ +
-    function getType(){ +
-        return 'formatting'; +
-    } +
-  +
-    /** +
-     * Where to sort in? +
-     */ +
-    function getSort(){ +
-        return 104; +
-    } +
-  +
-    /** +
-     * Connect pattern to lexer +
-     */ +
-    function connectTo($mode) { +
-      $this->Lexer->addEntryPattern('#\-(?=.*\-#)',$mode,'plugin_smaller'); +
-    } +
-  +
-    function postConnect() { +
-      $this->Lexer->addExitPattern('\-#','plugin_smaller'); +
-    } +
-  +
-    /** +
-     * Handle the match +
-     */ +
-    function handle($match, $state, $pos, &$handler){ +
-        return array($match, $state); +
-    } +
-  +
-    /** +
-     * Create output +
-     */ +
-    function render($mode, &$renderer, $data) { +
-        if($mode == 'xhtml'){ +
-            if ($data[1] == DOKU_LEXER_ENTER){ +
-                $renderer->doc .= '<span style="font-size:smaller">'; +
-            } else if ($data[1] == DOKU_LEXER_UNMATCHED){ +
-                $renderer->doc .= $renderer->_xmlEntities($data[0]); +
-            } else if ($data[1] == DOKU_LEXER_EXIT){ +
-                $renderer->doc .= '</span>'; +
-            } +
-            return true; +
-        } +
-        return false; +
-    } +
-  +
-+
-  +
-//Setup VIM: ex: et ts=4 enc=utf-8 : +
-?> +
-</code>+
plugin/smaller.1128498905.txt.gz · Last modified: 2011-06-18 17:02 (external edit)

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki