Enables a simple mark-up syntax for showing text edits being inserted or deleted from your wiki pages.
Compatible with DokuWiki
No compatibility info given!
Enables a simple mark-up syntax for showing text edits being inserted or deleted from your wiki pages.
The missing download url means that this extension cannot be installed via the Extension Manager. Please see Publishing a Plugin on dokuwiki.org. Recommended are public repository hosts like GitHub, GitLab or Bitbucket.
This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.
<del> ... </del>
is part of standard DokuWiki syntax. There is also a plugin which provides <ins> insert syntax. For me, I wanted something better for two reasons:
Feel free to play with it on my playground if you'd like..
You can use the plugin-manager to install this plugin. The URL is http://design1st.org/files/dokuwiki-plugin_inandout.tgz.
You simply put a “-” on both sides of the text you want to appear deleted or a “+” for it to appear inserted. The trick is that there can never be a space between the +/- and the text you are inserting/deleting. Despite this it deals with text that includes spaces and is smart enough to not be fooled by hyphenated words or phone numbers etc.
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 <del>indicated like this</del> where as text that is inserted is <ins>indicated like this</ins>.
Put this code into <your plugin-dir>/inandout/syntax.php
<?php /** * In and Out Plugin: Enables a custom mark-up for inserted and deleted text * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) * @author Timothy Martin */ 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_inandout extends DokuWiki_Syntax_Plugin { /** * return some info */ function getInfo(){ return array( 'author' => 'Timothy Martin', 'email' => 'instanttim@mac.com', 'date' => '2006-01-09', 'name' => 'In and Out Plugin', 'desc' => 'Enables a custom mark-up for inserted and deleted text.', 'url' => 'http://www.dokuwiki.org/plugin:inandout', ); } /** * What kind of syntax are we? */ function getType(){ return 'formatting'; } /** * What kind of syntax do we allow (optional) */ function getAllowedTypes() { return array('formatting', 'substition', 'disabled'); } /** * Where to sort in? */ function getSort(){ return 137; } /** * Connect pattern to lexer */ function connectTo($mode) { // This is the regex i used to use... // // /\B(-)(?!\s)(.*)(?<!\s)(-)\B/ // $this->Lexer->addEntryPattern('(?<=\B)-(?!\s)(?=.*\w-\B)',$mode,'plugin_inandout'); $this->Lexer->addEntryPattern('(?<=\B)\+(?!\s)(?=.*\w\+\B)',$mode,'plugin_inandout'); } function postConnect() { $this->Lexer->addExitPattern('(?<!\s)-(?=\B)','plugin_inandout'); $this->Lexer->addExitPattern('(?<!\s)\+(?=\B)','plugin_inandout'); } /** * Handle the match */ function handle($match, $state, $pos, &$handler) { switch ($state) { case DOKU_LEXER_ENTER : if ($match == "-") { return array($state, 'del'); } else if ($match == "+") { return array($state, 'ins'); } case DOKU_LEXER_UNMATCHED : return array($state, $match); case DOKU_LEXER_EXIT : if ($match == "-") { return array($state, 'del'); } else if ($match == "+") { return array($state, 'ins'); } } return array(); } /** * Create output */ function render($mode, &$renderer, $data) { if($mode == 'xhtml') { list($state, $match) = $data; switch ($state) { case DOKU_LEXER_ENTER : $renderer->doc .= "<".$match.">"; break; case DOKU_LEXER_UNMATCHED : $renderer->doc .= $renderer->_xmlEntities($match); break; case DOKU_LEXER_EXIT : $renderer->doc .= "</".$match.">"; break; } return true; } return false; } } ?>
Some notes:
<del> ... </del>
is part of standard DokuWiki syntax. There is also a plugin which provides <ins>
insert syntax. It would be handy to indicate that your syntax is an alternative to these other forms.(?<=\B)-(?>=[^ \r\n].+?[^ \r\n]-[ \r\n])
.[^\n\r]
instead of '.' in your look ahead for an ending pattern.I hope this help some. — Christopher Smith 2005-11-30 20:52
If you install this plugin, you're going to want to fix your “wiki:syntax” page as a sizable portion of the bottom of this page is striked out. — GaryV 2006-06-30 08:30
This plugin seems to break my wiki:syntax page completely. All that displays is the “You are here” box at the top of the page. I like this plugin, but I can't use it. — lenehey 2007-12-21 9:48