changeset 938:8effe95df6f0

added diff highlighting parser
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Thu, 13 Jul 2006 22:46:38 +0200
parents 1da203931dc7
children 916f6a5e4ca6 fbbee7e00ffe
files MoinMoin/parser/text_diff.py docs/CHANGES wiki/htdocs/classic/css/common.css wiki/htdocs/modern/css/common.css wiki/htdocs/rightsidebar/css/common.css
diffstat 5 files changed, 57 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MoinMoin/parser/text_diff.py	Thu Jul 13 22:46:38 2006 +0200
@@ -0,0 +1,39 @@
+# -*- coding: iso-8859-1 -*-
+"""
+    MoinMoin - Diff Parser - highlights diff tool output
+
+    @copyright: 2006 by Emilio Lopes, inspired by previous work
+                done by Fabien Ninoles and Jürgen Hermann
+    @license: GNU GPL, see COPYING for details.
+"""
+
+from MoinMoin.parser.ParserBase import ParserBase
+
+class Parser(ParserBase):
+    parsername = "ColorizedDiff"
+    extensions = ['.diff', '.patch', ]
+    Dependencies = []
+
+    def setupRules(self):
+        ParserBase.setupRules(self)
+
+        self.addRule("Comment", r'^(diff .*?)$')
+        self.addRule("Comment", r'^(\*\*\* .*?)$')
+        self.addRule("Comment", r'^(--- .*?)$')
+        self.addRule("Comment", r'^(\+\+\+ .*?)$')
+        self.addRule("Comment", r'^\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* *$')
+
+        self.addRule("DiffSeparator", r'^(@@ .*?)$')
+        self.addRule("DiffSeparator", r'^--- *$')
+
+        self.addRule("DiffAdded", r'^(\+.*?)$')
+        self.addRule("DiffRemoved", r'^(-.*?)$')
+        self.addRule("DiffAdded", r'^(>.*?)$')
+        self.addRule("DiffRemoved", r'^(<.*?)$')
+        self.addRule("DiffChanged", r'^(!.*?)$')
+
+        self.addRuleFormat("DiffAdded")
+        self.addRuleFormat("DiffRemoved")
+        self.addRuleFormat("DiffChanged")
+        self.addRuleFormat("DiffSeparator")
+
--- a/docs/CHANGES	Sun Jul 09 22:39:15 2006 +0200
+++ b/docs/CHANGES	Thu Jul 13 22:46:38 2006 +0200
@@ -161,6 +161,8 @@
     * Speeded up linkto search by avoiding read locks on the pagelinks file.
     * The i18n system no loads *.po files directly (no *.py or *.mo any more)
       and caches the results (farm wide cache/i18n/*).
+    * added the diff parser from ParserMarket, thanks to Emilio Lopes, Fabien
+      Ninoles and Jürgen Hermann.
 
   Bugfixes:
     * on action "info" page, "revert" link will not be displayed for empty page
--- a/wiki/htdocs/classic/css/common.css	Sun Jul 09 22:39:15 2006 +0200
+++ b/wiki/htdocs/classic/css/common.css	Thu Jul 13 22:46:38 2006 +0200
@@ -273,3 +273,9 @@
 div.codearea pre span.Preprc     {color: #803999;}
 
 
+/* for diff parser */
+div.codearea pre span.DiffAdded   {color: #4876FF;}
+div.codearea pre span.DiffRemoved {color: #FF0000;}
+div.codearea pre span.DiffChanged {color: #FF7F50;}
+div.codearea pre span.DiffSeparator {color: #228B22; font-weight: bold}
+
--- a/wiki/htdocs/modern/css/common.css	Sun Jul 09 22:39:15 2006 +0200
+++ b/wiki/htdocs/modern/css/common.css	Thu Jul 13 22:46:38 2006 +0200
@@ -324,6 +324,11 @@
 div.codearea pre span.Special    {color: #0000ff;}
 div.codearea pre span.Preprc     {color: #803999;}
 
+/* for diff parser */
+div.codearea pre span.DiffAdded   {color: #4876FF;}
+div.codearea pre span.DiffRemoved {color: #FF0000;}
+div.codearea pre span.DiffChanged {color: #FF7F50;}
+div.codearea pre span.DiffSeparator {color: #228B22; font-weight: bold}
 
 /* Search results */
 
--- a/wiki/htdocs/rightsidebar/css/common.css	Sun Jul 09 22:39:15 2006 +0200
+++ b/wiki/htdocs/rightsidebar/css/common.css	Thu Jul 13 22:46:38 2006 +0200
@@ -280,6 +280,11 @@
 div.codearea pre span.Special    {color: #0000ff;}
 div.codearea pre span.Preprc     {color: #803999;}
 
+/* for diff parser */
+div.codearea pre span.DiffAdded   {color: #4876FF;}
+div.codearea pre span.DiffRemoved {color: #FF0000;}
+div.codearea pre span.DiffChanged {color: #FF7F50;}
+div.codearea pre span.DiffSeparator {color: #228B22; font-weight: bold}
 
 /* MonthCalendar css */