plugin:diff
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
plugin:diff [2007-08-16 07:25] – doc update Matthias | plugin:diff [2023-10-30 22:41] (current) – Klap-in | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Diff Syntax PlugIn ====== | ||
+ | |||
+ | ---- plugin ---- | ||
+ | description: | ||
+ | author | ||
+ | email : support@mwat.de | ||
+ | type : syntax | ||
+ | lastupdate : 2007-08-15 | ||
+ | compatible : Greebo | ||
+ | depends | ||
+ | conflicts | ||
+ | similar | ||
+ | tags : code, revisions, syntaxhighlight | ||
+ | |||
+ | downloadurl: | ||
+ | ---- | ||
+ | |||
+ | The '' | ||
+ | [[ftp:// | ||
+ | [[ftp:// | ||
+ | This differences are often called //patches// and in turn are used to modify other unpatched source files. | ||
+ | It doesn' | ||
+ | As long as it is a text file((i.e. not a binary file produced by a bloated text processing software)) one can produce -- and distribute if appropriate -- a //patch// file((not to be confused with so-called " | ||
+ | Instead of being forced to manually type in the differences (e.g. modified source code) one can simply pass the output of [[http:// | ||
+ | |||
+ | This plugin not only allows to insert such a patchfile into your Wiki | ||
+ | page((which could be done easily by use of DokuWiki' | ||
+ | It is intended for developers wanting to document and/or distribute changes they' | ||
+ | The plugin handles besides the most often used //unified output format// also the //context output format// as well as the less common //RCS// and //simple// (default) output formats. | ||
+ | |||
+ | :!: **Note**, there' | ||
+ | So if you've installed that [[code2|code]] plugin you won't need this one! | ||
+ | |||
+ | ===== Usage ===== | ||
+ | |||
+ | To actually use this plugin just place the output of the '' | ||
+ | Both the opening and closing tag must stand on its own line before and behind the '' | ||
+ | In practice you would do something like\\ | ||
+ | ''// | ||
+ | to write the differences between '' | ||
+ | to the file '' | ||
+ | The latter (surrounded by '' | ||
+ | |||
+ | The [[#Plugin Source|plugin]] understands not only the //unified// output format | ||
+ | To speed up operation you should use\\ | ||
+ | '' | ||
+ | to start a //simple// patch((created by '' | ||
+ | '' | ||
+ | to start a //context// patch((created by the '' | ||
+ | '' | ||
+ | to start a //context// patch((created by the '' | ||
+ | '' | ||
+ | to start a //unified// patch((created by the '' | ||
+ | |||
+ | By providing such a hint some RegEx tests are avoided and hence | ||
+ | both memory and runtime are saved. | ||
+ | |||
+ | ==== Examples ==== | ||
+ | |||
+ | For demonstration purposes consider the following HTML fragment: | ||
+ | <code html> | ||
+ | < | ||
+ | ullamcorper id, velit. Donec at orci in leo nonummy | ||
+ | fermentum. Vestibulum pellentesque wisi sed magna. | ||
+ | This line will get deleted. Elementum mattis nullam. | ||
+ | vehicula gravida tortor. Donec vel ante quis ipsum | ||
+ | dapibus. Cras ultrices. Sed egestas neque nec augue | ||
+ | congue ornare. This line will get modified. | ||
+ | Sed sit amet lectus ac nibh porta mollis. Aenean justo. | ||
+ | Pellentesque nonummy nunc eu lacus. Praesent tincidunt | ||
+ | mollis wisi donec id est. Proin odio wisi, ornare vitae, | ||
+ | scelerisque non, ultrices vel, dolor. Vestibulum ante | ||
+ | ipsum primis in faucibus orci luctus et ultrices posuere | ||
+ | cubilia Curae; there will be an addition! | ||
+ | Nulla nec risus. Aliquam erat volutpat. Integer non dui | ||
+ | id justo sodales dignissim. In molestie suscipit ipsum. | ||
+ | Donec nonummy mauris id justo.</ | ||
+ | </ | ||
+ | After review by several people there were some changes to be made: | ||
+ | <code html> | ||
+ | < | ||
+ | ullamcorper id, velit. Donec at orci in leo nonummy | ||
+ | fermentum. Vestibulum pellentesque wisi sed magna. | ||
+ | vehicula gravida tortor. Donec vel ante quis ipsum | ||
+ | dapibus. Cras ultrices. Sed egestas neque nec augue | ||
+ | congue ornare. This line is now modified as requested. | ||
+ | Sed sit amet lectus ac nibh porta mollis. Aenean justo. | ||
+ | Pellentesque nonummy nunc eu lacus. Praesent tincidunt | ||
+ | mollis wisi donec id est. Proin odio wisi, ornare vitae, | ||
+ | scelerisque non, ultrices vel, dolor. Vestibulum ante | ||
+ | ipsum primis in faucibus orci luctus et ultrices posuere | ||
+ | cubilia Curae; there will be an addition! | ||
+ | Elementum mattis nullam. Maecenas egestas posuere wisi. | ||
+ | Nulla nec risus. Aliquam erat volutpat. Integer non dui | ||
+ | id justo sodales dignissim. In molestie suscipit ipsum. | ||
+ | Donec nonummy mauris id justo.</ | ||
+ | </ | ||
+ | Now lets see the various '' | ||
+ | There are many options for both the '' | ||
+ | For more details about them please refer to the respective man pages of your beloved GNU/Linux (or legacy CygWin/ | ||
+ | I have ordered the '' | ||
+ | |||
+ | === Unified diff === | ||
+ | diff -u lorem.orig lorem.new | ||
+ | produces: | ||
+ | <code diff> | ||
+ | --- lorem.orig 2007-01-12 14: | ||
+ | +++ lorem.new 2007-01-12 14: | ||
+ | @@ -1,16 +1,16 @@ | ||
+ | < | ||
+ | | ||
+ | | ||
+ | - This line will get deleted. Elementum mattis nullam. | ||
+ | | ||
+ | | ||
+ | - congue ornare. This line will get modified. | ||
+ | + congue ornare. This line is now modified as requested. | ||
+ | Sed sit amet lectus ac nibh porta mollis. Aenean justo. | ||
+ | | ||
+ | | ||
+ | | ||
+ | ipsum primis in faucibus orci luctus et ultrices posuere | ||
+ | | ||
+ | + Elementum mattis nullam. Maecenas egestas posuere wisi. | ||
+ | Nulla nec risus. Aliquam erat volutpat. Integer non dui | ||
+ | id justo sodales dignissim. In molestie suscipit ipsum. | ||
+ | Donec nonummy mauris id justo.</ | ||
+ | </ | ||
+ | This is the most popular format. | ||
+ | It contains filenames and -dates. | ||
+ | It tells the starting line and length of a modified block. | ||
+ | There are only added lines (marked by "'' | ||
+ | |||
+ | The differences are scannable by both the '' | ||
+ | |||
+ | === Context diff === | ||
+ | diff -c lorem.orig lorem.new | ||
+ | produces: | ||
+ | <code diff> | ||
+ | *** lorem.orig 2007-01-12 14: | ||
+ | --- lorem.new 2007-01-12 14: | ||
+ | *************** | ||
+ | *** 1,16 **** | ||
+ | < | ||
+ | ullamcorper id, velit. Donec at orci in leo nonummy | ||
+ | fermentum. Vestibulum pellentesque wisi sed magna. | ||
+ | - This line will get deleted. Elementum mattis nullam. | ||
+ | vehicula gravida tortor. Donec vel ante quis ipsum | ||
+ | dapibus. Cras ultrices. Sed egestas neque nec augue | ||
+ | ! | ||
+ | Sed sit amet lectus ac nibh porta mollis. Aenean justo. | ||
+ | Pellentesque nonummy nunc eu lacus. Praesent tincidunt | ||
+ | mollis wisi donec id est. Proin odio wisi, ornare vitae, | ||
+ | scelerisque non, ultrices vel, dolor. Vestibulum ante | ||
+ | ipsum primis in faucibus orci luctus et ultrices posuere | ||
+ | cubilia Curae; there will be an addition! | ||
+ | Nulla nec risus. Aliquam erat volutpat. Integer non dui | ||
+ | id justo sodales dignissim. In molestie suscipit ipsum. | ||
+ | Donec nonummy mauris id justo.</ | ||
+ | --- 1,16 ---- | ||
+ | < | ||
+ | ullamcorper id, velit. Donec at orci in leo nonummy | ||
+ | fermentum. Vestibulum pellentesque wisi sed magna. | ||
+ | vehicula gravida tortor. Donec vel ante quis ipsum | ||
+ | dapibus. Cras ultrices. Sed egestas neque nec augue | ||
+ | ! | ||
+ | Sed sit amet lectus ac nibh porta mollis. Aenean justo. | ||
+ | Pellentesque nonummy nunc eu lacus. Praesent tincidunt | ||
+ | mollis wisi donec id est. Proin odio wisi, ornare vitae, | ||
+ | scelerisque non, ultrices vel, dolor. Vestibulum ante | ||
+ | ipsum primis in faucibus orci luctus et ultrices posuere | ||
+ | cubilia Curae; there will be an addition! | ||
+ | + | ||
+ | Nulla nec risus. Aliquam erat volutpat. Integer non dui | ||
+ | id justo sodales dignissim. In molestie suscipit ipsum. | ||
+ | Donec nonummy mauris id justo.</ | ||
+ | </ | ||
+ | Here are filenames and dates transported as well as the starting line and modified range. | ||
+ | There are three kind of changes: removed lines ("'' | ||
+ | |||
+ | But there are two " | ||
+ | The first indicating removed lines and somehow changed ones; | ||
+ | the second holding the actual changes and additions. | ||
+ | |||
+ | === Simple diff === | ||
+ | diff lorem.orig lorem.new | ||
+ | produces: | ||
+ | <code diff> | ||
+ | 4d3 | ||
+ | < This line will get deleted. Elementum mattis nullam. | ||
+ | 7c6 | ||
+ | < | ||
+ | --- | ||
+ | > | ||
+ | 13a13 | ||
+ | > | ||
+ | </ | ||
+ | This format transports by default neither filenames nor -dates. | ||
+ | There are two kind of changes: | ||
+ | Removed lines (marked "''<''" | ||
+ | |||
+ | Besides the raw differences there' | ||
+ | Most probably such a patch will fail. | ||
+ | |||
+ | === RCS diff === | ||
+ | diff -n lorem.orig lorem.new | ||
+ | produces: | ||
+ | <code diff> | ||
+ | d4 1 | ||
+ | d7 1 | ||
+ | a7 1 | ||
+ | congue ornare. This line is now modified as requested. | ||
+ | a13 1 | ||
+ | Elementum mattis nullam. Maecenas egestas posuere wisi. | ||
+ | </ | ||
+ | As with the simple format there are neither filenames nor -dates. | ||
+ | Removed lines are marked by "'' | ||
+ | Added lines are marked "'' | ||
+ | |||
+ | This is the most compact patch format. | ||
+ | But since no context is provided it not only makes it hard for humans to read //and// understand. | ||
+ | |||
+ | Nowadays, with distributed development and parallel source modifications by different persons, it's rather useless. | ||
+ | In contrast the //unified output format// (as well as the -- larger -- | ||
+ | //context format//) provides some context lines((the number of which can be controlled by a commandline argument)) allowing the '' | ||
+ | Apart from that the //unified format// makes it easier for humans to figure out the meaning. | ||
+ | |||
+ | ===== Installation ===== | ||
+ | Search and install the plugin using the [[plugin: | ||
+ | |||
+ | Alternatively, | ||
+ | |||
+ | - Download the [[http:// | ||
+ | - Make sure both the new directory and the files therein are readable by the web-server e.g.< | ||
+ | chown apache: | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Plugin Source ===== | ||
+ | |||
+ | Here comes the [[http:// | ||
+ | Since I'm working with different programming languages it's a great ease to have one tool that handles the docs for all of them.)) for those who'd like to scan it before actually installing it: | ||
+ | <code php> | ||
+ | <?php | ||
+ | if (! class_exists(' | ||
+ | if (! defined(' | ||
+ | if (! defined(' | ||
+ | define(' | ||
+ | } // if | ||
+ | define(' | ||
+ | } // if | ||
+ | // Include parent class: | ||
+ | require_once(DOKU_PLUGIN . ' | ||
+ | |||
+ | /** | ||
+ | * < | ||
+ | * plugin for highlighting < | ||
+ | * pages. | ||
+ | * | ||
+ | * <p> | ||
+ | * The purpose of this plugin is to provide a facility for inserting | ||
+ | * a < | ||
+ | * using the < | ||
+ | * visual feedback (so-called " | ||
+ | * added/ | ||
+ | * </p> | ||
+ | * <p> | ||
+ | * Three types of < | ||
+ | * </p> | ||
+ | * <dl> | ||
+ | * < | ||
+ | * < | ||
+ | * commandline format option.</ | ||
+ | * < | ||
+ | * < | ||
+ | * commandline format option.</ | ||
+ | * < | ||
+ | * < | ||
+ | * commandline format option.</ | ||
+ | * < | ||
+ | * < | ||
+ | * format option.</ | ||
+ | * </ | ||
+ | | ||
+ | | ||
+ | | ||
+ | * </ | ||
+ | * <div class=" | ||
+ | * This program is free software; you can redistribute it and/or modify | ||
+ | * it under the terms of the GNU General Public License as published by | ||
+ | * the Free Software Foundation; either | ||
+ | * <a href=" | ||
+ | * License, or (at your option) any later version.< | ||
+ | * This software is distributed in the hope that it will be useful, but | ||
+ | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
+ | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
+ | * General Public License for more details. | ||
+ | * </ | ||
+ | * @author <a href=" | ||
+ | * @version < | ||
+ | * @since created 14-Aug-2005 | ||
+ | */ | ||
+ | class syntax_plugin_diff extends DokuWiki_Syntax_Plugin { | ||
+ | |||
+ | /** | ||
+ | * @privatesection | ||
+ | */ | ||
+ | //@{ | ||
+ | |||
+ | /** | ||
+ | * Prepare the markup to render the DIFF text. | ||
+ | * | ||
+ | * @param $aText String The DIFF text to markup. | ||
+ | * @param $aFormat String The DIFF format used (' | ||
+ | * @param $aDoc String Reference to the current renderer' | ||
+ | * < | ||
+ | * @return Boolean < | ||
+ | * @private | ||
+ | * @see render() | ||
+ | */ | ||
+ | function _addDiff(& | ||
+ | // Since we're inside a PRE block we need the leading LFs: | ||
+ | $ADD = " | ||
+ | $DEL = " | ||
+ | $HEAD = " | ||
+ | $CLOSE = '</ | ||
+ | // Common headers for all formats; | ||
+ | // the RegEx needs at least ' | ||
+ | $DiffHead = '# | ||
+ | . ' | ||
+ | switch ($aFormat) { | ||
+ | case ' | ||
+ | $aDoc .= preg_replace( | ||
+ | array($DiffHead . ' | ||
+ | ' | ||
+ | ' | ||
+ | array($HEAD . ' | ||
+ | $ADD . ' | ||
+ | $DEL . ' | ||
+ | $aText); | ||
+ | return TRUE; | ||
+ | case ' | ||
+ | $sections = preg_split(' | ||
+ | preg_replace($DiffHead . ' | ||
+ | $HEAD . ' | ||
+ | $aText), | ||
+ | -1, PREG_SPLIT_DELIM_CAPTURE); | ||
+ | $sections[0] = preg_replace( | ||
+ | array(' | ||
+ | ' | ||
+ | array($ADD . ' | ||
+ | $DEL . ' | ||
+ | $sections[0]); | ||
+ | $c = count($sections); | ||
+ | for ($i = 1; $c > $i; ++$i) { | ||
+ | $hits = array(); | ||
+ | if (preg_match(' | ||
+ | $sections[$i], | ||
+ | unset($hits[0]); | ||
+ | $sections[$i] = $HEAD . $hits[1] . $CLOSE; | ||
+ | } else if (preg_match(' | ||
+ | $sections[$i], | ||
+ | unset($hits[0]); | ||
+ | $parts = preg_split(' | ||
+ | $hits[2], -1, PREG_SPLIT_DELIM_CAPTURE); | ||
+ | // $parts[0] == OLD code | ||
+ | $parts[0] = preg_replace(' | ||
+ | $DEL . ' | ||
+ | // $parts[1] == head of NEW code | ||
+ | $parts[1] = $ADD . $parts[1] . $CLOSE; | ||
+ | // $parts[2] == NEW code | ||
+ | $parts[2] = preg_replace( | ||
+ | array(' | ||
+ | ' | ||
+ | array($ADD . ' | ||
+ | $DEL . ' | ||
+ | $parts[2]); | ||
+ | if (isset($parts[3])) { | ||
+ | // TRUE when handling multi-file patches | ||
+ | $parts[3] = preg_replace(' | ||
+ | $ADD . ' | ||
+ | } // if | ||
+ | $sections[$i] = $DEL . $hits[1] . $CLOSE | ||
+ | . implode('', | ||
+ | } // if | ||
+ | // ELSE: leave $sections[$i] as is | ||
+ | } // for | ||
+ | $aDoc .= implode('', | ||
+ | return TRUE; | ||
+ | case ' | ||
+ | // Only added lines are there so we highlight just the | ||
+ | // diff indicators while leaving the text alone. | ||
+ | $aDoc .= preg_replace( | ||
+ | array($DiffHead . ' | ||
+ | ' | ||
+ | ' | ||
+ | array($HEAD . ' | ||
+ | $DEL . ' | ||
+ | $ADD . ' | ||
+ | $aText); | ||
+ | return TRUE; | ||
+ | case ' | ||
+ | $aDoc .= preg_replace( | ||
+ | array($DiffHead . ' | ||
+ | ' | ||
+ | ' | ||
+ | array($HEAD . ' | ||
+ | $DEL . ' | ||
+ | $ADD . ' | ||
+ | $aText); | ||
+ | return TRUE; | ||
+ | default: | ||
+ | $aDoc .= $aText; | ||
+ | return TRUE; | ||
+ | } // switch | ||
+ | } // _addDiff() | ||
+ | |||
+ | //@} | ||
+ | /** | ||
+ | * @publicsection | ||
+ | */ | ||
+ | //@{ | ||
+ | |||
+ | /** | ||
+ | * Tell the parser whether the plugin accepts syntax mode | ||
+ | * < | ||
+ | * | ||
+ | * <p> | ||
+ | * This method returns < | ||
+ | * types are allowed within a < | ||
+ | * </p> | ||
+ | * @param $aMode String The requested syntaxmode. | ||
+ | * @return Boolean < | ||
+ | * @public | ||
+ | */ | ||
+ | function accepts($aMode) { | ||
+ | return FALSE; | ||
+ | } // accepts() | ||
+ | |||
+ | /** | ||
+ | * Connect lookup pattern to lexer. | ||
+ | * | ||
+ | * @param $aMode String The desired rendermode. | ||
+ | * @public | ||
+ | * @see render() | ||
+ | */ | ||
+ | function connectTo($aMode) { | ||
+ | $this-> | ||
+ | ' | ||
+ | $aMode, ' | ||
+ | } // connectTo() | ||
+ | |||
+ | /** | ||
+ | * Get an associative array with plugin info. | ||
+ | * | ||
+ | * <p> | ||
+ | * The returned array holds the following fields: | ||
+ | * <dl> | ||
+ | * < | ||
+ | * < | ||
+ | * < | ||
+ | * < | ||
+ | * < | ||
+ | * < | ||
+ | * < | ||
+ | * (eg. syntax description)</ | ||
+ | * </dl> | ||
+ | * @return Array Information about this plugin class. | ||
+ | * @public | ||
+ | * @static | ||
+ | */ | ||
+ | function getInfo() { | ||
+ | return array( | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | } // getInfo() | ||
+ | |||
+ | /** | ||
+ | * Define how this plugin is handled regarding paragraphs. | ||
+ | * | ||
+ | * <p> | ||
+ | * This method is important for correct XHTML nesting. It returns | ||
+ | * one of the following values: | ||
+ | * </p> | ||
+ | * <dl> | ||
+ | * < | ||
+ | * < | ||
+ | * plugin output.</ | ||
+ | * < | ||
+ | * </dl> | ||
+ | * @return String < | ||
+ | * @public | ||
+ | * @static | ||
+ | */ | ||
+ | function getPType() { | ||
+ | return ' | ||
+ | } // getPType() | ||
+ | |||
+ | /** | ||
+ | * Where to sort in? | ||
+ | * | ||
+ | * <p> | ||
+ | * This method returns < | ||
+ | * < | ||
+ | * < | ||
+ | * </p> | ||
+ | * @return Integer < | ||
+ | * @public | ||
+ | * @static | ||
+ | */ | ||
+ | function getSort() { | ||
+ | return 174; | ||
+ | } // getSort() | ||
+ | |||
+ | /** | ||
+ | * Get the type of syntax this plugin defines. | ||
+ | * | ||
+ | * @return String < | ||
+ | * @public | ||
+ | * @static | ||
+ | */ | ||
+ | function getType() { | ||
+ | return ' | ||
+ | } // getType() | ||
+ | |||
+ | /** | ||
+ | * Handler to prepare matched data for the rendering process. | ||
+ | * | ||
+ | * <p> | ||
+ | * The < | ||
+ | * triggered the call to this method: | ||
+ | * </ | ||
+ | * < | ||
+ | * <dd>a pattern set by < | ||
+ | * < | ||
+ | * <dd> a pattern set by < | ||
+ | * < | ||
+ | * < | ||
+ | * which doesn' | ||
+ | * </dl> | ||
+ | * @param $aMatch String The text matched by the patterns. | ||
+ | * @param $aState Integer The lexer state for the match. | ||
+ | * @param $aPos Integer The character position of the matched text. | ||
+ | * @param $aHandler Object Reference to the Doku_Handler object. | ||
+ | * @return Array Index < | ||
+ | * < | ||
+ | * < | ||
+ | * format or < | ||
+ | * index < | ||
+ | * @public | ||
+ | * @see render() | ||
+ | * @static | ||
+ | */ | ||
+ | function handle($aMatch, | ||
+ | if (DOKU_LEXER_UNMATCHED == $aState) { | ||
+ | $aMatch = explode('>', | ||
+ | if (" | ||
+ | // A leading LF is needed to recognize and handle | ||
+ | // the very first line with all the REs used. | ||
+ | $aMatch[1] = " | ||
+ | } // if | ||
+ | } else { | ||
+ | return array($aState); | ||
+ | } // if | ||
+ | $aMatch[0] = strtolower(trim($aMatch[0])) . '?'; | ||
+ | switch ($aMatch[0] = $aMatch[0]{0}) { | ||
+ | case ' | ||
+ | case ' | ||
+ | case ' | ||
+ | case ' | ||
+ | // We believe the format hint ... | ||
+ | // (or should we be more suspicious? | ||
+ | break; | ||
+ | case ' | ||
+ | $aMatch[0] = ' | ||
+ | break; | ||
+ | default: | ||
+ | if (preg_match( | ||
+ | ' | ||
+ | $aMatch[1])) { | ||
+ | $aMatch[0] = ' | ||
+ | } else if (preg_match( | ||
+ | ' | ||
+ | $aMatch[1])) { | ||
+ | $aMatch[0] = ' | ||
+ | } else if (preg_match( | ||
+ | ' | ||
+ | // We've to check this _before_ ' | ||
+ | // are similar (this one is slightly more specific) | ||
+ | $aMatch[0] = ' | ||
+ | } else if (preg_match( | ||
+ | ' | ||
+ | $aMatch[1])) { | ||
+ | $aMatch[0] = ' | ||
+ | } else { | ||
+ | $aMatch[0] = '?'; | ||
+ | } // if | ||
+ | } // switch | ||
+ | return array($aState, | ||
+ | array('&', | ||
+ | array('&# | ||
+ | $aMatch[1])); | ||
+ | } // handle() | ||
+ | |||
+ | /** | ||
+ | * Add exit pattern to lexer. | ||
+ | * | ||
+ | * @public | ||
+ | */ | ||
+ | function postConnect() { | ||
+ | $this-> | ||
+ | } // postConnect() | ||
+ | |||
+ | /** | ||
+ | * Handle the actual output creation. | ||
+ | * | ||
+ | * <p> | ||
+ | * The method checks for the given < | ||
+ | * < | ||
+ | * contains a reference to the renderer object which is currently | ||
+ | * handling the rendering. The contents of < | ||
+ | * return value of the < | ||
+ | * </p> | ||
+ | * @param $aFormat String The output format to being tendered. | ||
+ | * @param $aRenderer Object A reference to the renderer object. | ||
+ | * @param $aData Array The data created by the < | ||
+ | * method. | ||
+ | * @return Boolean < | ||
+ | * < | ||
+ | * @public | ||
+ | * @see handle() | ||
+ | */ | ||
+ | function render($aFormat, | ||
+ | if (' | ||
+ | return FALSE; | ||
+ | } // if | ||
+ | switch ($aData[0]) { | ||
+ | case DOKU_LEXER_UNMATCHED: | ||
+ | return $this-> | ||
+ | case DOKU_LEXER_ENTER: | ||
+ | $aRenderer-> | ||
+ | return TRUE; | ||
+ | case DOKU_LEXER_EXIT: | ||
+ | $aRenderer-> | ||
+ | default: | ||
+ | return TRUE; | ||
+ | } // switch | ||
+ | } // render() | ||
+ | |||
+ | //@} | ||
+ | } // class syntax_plugin_diff | ||
+ | } // if | ||
+ | //Setup VIM: ex: et ts=2 enc=utf-8 : | ||
+ | ?> | ||
+ | </ | ||
+ | |||
+ | ==== Presentation ==== | ||
+ | The accompanying CSS presentation rules: | ||
+ | <code css> | ||
+ | .diff .diff-addedline{background:# | ||
+ | .diff .diff-deletedline{background:# | ||
+ | .diff .diff-blockheader{background:# | ||
+ | </ | ||
+ | This shows added lines with //green// and removed lines with //red// background, while the files/ | ||
+ | |||
+ | Of course, you're free to modify this styles((The [[http:// | ||
+ | |||
+ | ==== Changes ==== | ||
+ | |||
+ | __2007-08-15__: | ||
+ | * added GPL link and fixed some doc problems; | ||
+ | |||
+ | __2007-02-02__: | ||
+ | * made some REs nonpossessive in ' | ||
+ | |||
+ | __2007-01-12__: | ||
+ | + added ' | ||
+ | |||
+ | __2007-01-10__: | ||
+ | + implemented (recognition/ | ||
+ | |||
+ | __2007-01-05__: | ||
+ | * modified ' | ||
+ | * replaced IF/ELSE blocks in ' | ||
+ | * moved entity encoding from ' | ||
+ | |||
+ | __2005-09-06__: | ||
+ | + added highlighting of '' | ||
+ | * improved handling of '' | ||
+ | |||
+ | __2005-09-01__: | ||
+ | * changed type from ' | ||
+ | * minor internal changes; | ||
+ | |||
+ | __2005-08-28__: | ||
+ | * modifications to improve recognition of context-diffs and multi-file patches; | ||
+ | |||
+ | __2005-08-17__: | ||
+ | + implemented ' | ||
+ | |||
+ | // | ||
+ | |||
+ | ===== See also ===== | ||
+ | |||
+ | There' | ||
+ | so if you've installed [[code2|that]] one you won't need [[#Diff Syntax PlugIn|this]]. | ||
+ | |||
+ | The [[http:// | ||
+ | |||
+ | A GUI for '' | ||
+ | |||
+ | ==== Plugins by the same author ==== | ||
+ | |||
+ | * [[bomfix|BOMfix Plugin]] -- ignore Byte-Order-Mark characters in your pages | ||
+ | * [[code2|Code Syntax Plugin]] -- use syntax highlighting of code fragments in your pages | ||
+ | * [[deflist|Definition List Syntax Plugin]] -- use the only complete definition lists in your pages | ||
+ | * [[diff|Diff Syntax Plugin]] -- use highlighting of diff files (aka " | ||
+ | * [[hr|HR Syntax Plugin]] -- use horizontal rules in nested block elements of your pages | ||
+ | * [[lang|LANGuage Syntax Plugin]] -- markup different languages in your pages | ||
+ | * [[lists|Lists Syntax Plugin]] -- use the only complete un-/ordered lists in your pages | ||
+ | * [[nbsp|NBSP Syntax Plugin]] -- use Non-Breakable-Spaces in your pages | ||
+ | * [[nstoc|NsToC Syntax Plugin]] -- use automatically generated namespace indices | ||
+ | * [[shy|Shy Syntax Plugin]] -- use soft hyphens in your pages | ||
+ | * [[tip|Tip Syntax Plugin]] -- add hint areas to your pages | ||
+ | |||
+ | ===== Discussion ===== | ||
+ | Hints, comments, suggestions ... | ||
+ | |||
+ | |||
+ | |||
+ | > Am I right in thinking that this plugin is irrelevant to those of us who do not have command line access to a *nix server? | ||
+ | |||
+ | >> No, this plugin allows for // | ||
+ | |||
+ | ===== Discussion ===== | ||
+ | |||
+ | > diff [[syntax# | ||
+ | |||
+ | >> | ||
+ | |||
+ | >>> | ||
+ | |||
+ | <code diff> | ||
+ | 204c204,206 | ||
+ | < | ||
+ | --- | ||
+ | > | ||
+ | > | ||
+ | > | ||
+ | </ | ||
+ | |||
+ | >> Well, I downloaded that GeSHi archive. Its '' | ||
+ | |||
+ | >>> | ||
+ | |||
+ | >>>> | ||
+ | >>>>> | ||
+ | |||
+ | >> I've updated the plugin which now supports all three '' | ||
+ | |||
+ | \\ | ||