plugin:inandout
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
Previous revisionNext revision | |||
— | plugin:inandout [2009-10-07 23:31] – tag cleanup laynee | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== In and Out Plugin ====== | ||
+ | ---- plugin ---- | ||
+ | description: | ||
+ | author | ||
+ | email : instanttim@mac.com | ||
+ | type : syntax | ||
+ | lastupdate : 2006-01-09 | ||
+ | compatible : | ||
+ | depends | ||
+ | conflicts | ||
+ | similar | ||
+ | tags : inserted, deleted | ||
+ | ---- | ||
+ | |||
+ | ===== Background ===== | ||
+ | |||
+ | '' | ||
+ | - Because of the frequency which I use these features | ||
+ | - Standard HTML tags severely limit the readability of the page when editing, | ||
+ | |||
+ | Feel free to play with it on my [[http:// | ||
+ | |||
+ | ===== Installation ===== | ||
+ | |||
+ | You can use the plugin-manager to install this plugin. The URL is [[http:// | ||
+ | |||
+ | |||
+ | ===== Syntax ===== | ||
+ | |||
+ | You simply put a " | ||
+ | |||
+ | ===== Example ===== | ||
+ | |||
+ | Input (Plain Text): | ||
+ | < | ||
+ | Text that you wish to be deleted should be -indicated like this- where as | ||
+ | text that is inserted is +indicated like this+. | ||
+ | </ | ||
+ | |||
+ | Output (HTML): | ||
+ | < | ||
+ | Text that you wish to be deleted should be < | ||
+ | text that is inserted is < | ||
+ | </ | ||
+ | |||
+ | ===== Plugin ===== | ||
+ | |||
+ | Put this code into <your plugin-dir>/ | ||
+ | |||
+ | <code php> | ||
+ | <?php | ||
+ | /** | ||
+ | * In and Out Plugin: Enables a custom mark-up for inserted and deleted text | ||
+ | * | ||
+ | * @license | ||
+ | * @author | ||
+ | */ | ||
+ | |||
+ | |||
+ | if(!defined(' | ||
+ | if(!defined(' | ||
+ | require_once(DOKU_PLUGIN.' | ||
+ | |||
+ | /** | ||
+ | * All DokuWiki plugins to extend the parser/ | ||
+ | * need to inherit from this class | ||
+ | */ | ||
+ | class syntax_plugin_inandout extends DokuWiki_Syntax_Plugin { | ||
+ | |||
+ | /** | ||
+ | * return some info | ||
+ | */ | ||
+ | function getInfo(){ | ||
+ | return array( | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ); | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * What kind of syntax are we? | ||
+ | */ | ||
+ | function getType(){ | ||
+ | return ' | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * What kind of syntax do we allow (optional) | ||
+ | */ | ||
+ | function getAllowedTypes() { | ||
+ | return array(' | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * Where to sort in? | ||
+ | */ | ||
+ | function getSort(){ | ||
+ | return 137; | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * Connect pattern to lexer | ||
+ | */ | ||
+ | function connectTo($mode) { | ||
+ | // This is the regex i used to use... | ||
+ | // | ||
+ | // / | ||
+ | // | ||
+ | $this-> | ||
+ | $this-> | ||
+ | } | ||
+ | |||
+ | function postConnect() { | ||
+ | $this-> | ||
+ | $this-> | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * Handle the match | ||
+ | */ | ||
+ | function handle($match, | ||
+ | switch ($state) { | ||
+ | case DOKU_LEXER_ENTER : | ||
+ | if ($match == " | ||
+ | return array($state, | ||
+ | } else if ($match == " | ||
+ | return array($state, | ||
+ | } | ||
+ | case DOKU_LEXER_UNMATCHED : | ||
+ | return array($state, | ||
+ | case DOKU_LEXER_EXIT : | ||
+ | if ($match == " | ||
+ | return array($state, | ||
+ | } else if ($match == " | ||
+ | return array($state, | ||
+ | } | ||
+ | } | ||
+ | return array(); | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * Create output | ||
+ | */ | ||
+ | function render($mode, | ||
+ | if($mode == ' | ||
+ | list($state, | ||
+ | switch ($state) { | ||
+ | case DOKU_LEXER_ENTER : | ||
+ | $renderer-> | ||
+ | break; | ||
+ | case DOKU_LEXER_UNMATCHED : | ||
+ | $renderer-> | ||
+ | break; | ||
+ | case DOKU_LEXER_EXIT : | ||
+ | $renderer-> | ||
+ | break; | ||
+ | } | ||
+ | return true; | ||
+ | } | ||
+ | return false; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | ?> | ||
+ | </ | ||
+ | |||
+ | ===== Bugs ===== | ||
+ | * I have found a bug where the minus sign in quotes will screw it up. | ||
+ | |||
+ | |||
+ | ===== Discussion ===== | ||
+ | |||
+ | Some notes: | ||
+ | * < | ||
+ | * This really should be done as two plugin components, one for //insert// and another for // | ||
+ | * < | ||
+ | * < | ||
+ | |||
+ | I hope this help some. --- // | ||
+ | |||
+ | If you install this plugin, you're going to want to fix your " | ||
+ | |||
+ | This plugin seems to break my wiki:syntax page completely. |
plugin/inandout.txt · Last modified: 2015-04-04 05:20 by PatrickBrown