annotate MoinMoin/parser/text_diff.py @ 1918:bb2e053067fb

fixing copyright headers: remove umlauts (encoding troubles), make epydoc compatible, reformat
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 27 Mar 2007 21:07:33 +0200
parents 52b85612832f
children 5638ffa2fb38
rev   line source
938
8effe95df6f0 added diff highlighting parser
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
1 # -*- coding: iso-8859-1 -*-
8effe95df6f0 added diff highlighting parser
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
2 """
8effe95df6f0 added diff highlighting parser
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
3 MoinMoin - Diff Parser - highlights diff tool output
8effe95df6f0 added diff highlighting parser
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
4
1918
bb2e053067fb fixing copyright headers: remove umlauts (encoding troubles), make epydoc compatible, reformat
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1128
diff changeset
5 @copyright: 2006 Emilio Lopes, inspired by previous work
bb2e053067fb fixing copyright headers: remove umlauts (encoding troubles), make epydoc compatible, reformat
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1128
diff changeset
6 done by Fabien Ninoles and Juergen Hermann
938
8effe95df6f0 added diff highlighting parser
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
7 @license: GNU GPL, see COPYING for details.
8effe95df6f0 added diff highlighting parser
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
8 """
8effe95df6f0 added diff highlighting parser
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
9
1128
52b85612832f rename ParserBase module to get it out from parser.modules list (it is no plugin)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 938
diff changeset
10 from MoinMoin.parser._ParserBase import ParserBase
938
8effe95df6f0 added diff highlighting parser
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
11
8effe95df6f0 added diff highlighting parser
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
12 class Parser(ParserBase):
8effe95df6f0 added diff highlighting parser
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
13 parsername = "ColorizedDiff"
8effe95df6f0 added diff highlighting parser
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
14 extensions = ['.diff', '.patch', ]
8effe95df6f0 added diff highlighting parser
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
15 Dependencies = []
8effe95df6f0 added diff highlighting parser
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
16
8effe95df6f0 added diff highlighting parser
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
17 def setupRules(self):
8effe95df6f0 added diff highlighting parser
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
18 ParserBase.setupRules(self)
8effe95df6f0 added diff highlighting parser
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
19
8effe95df6f0 added diff highlighting parser
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
20 self.addRule("Comment", r'^(diff .*?)$')
8effe95df6f0 added diff highlighting parser
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
21 self.addRule("Comment", r'^(\*\*\* .*?)$')
8effe95df6f0 added diff highlighting parser
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
22 self.addRule("Comment", r'^(--- .*?)$')
8effe95df6f0 added diff highlighting parser
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
23 self.addRule("Comment", r'^(\+\+\+ .*?)$')
8effe95df6f0 added diff highlighting parser
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
24 self.addRule("Comment", r'^\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* *$')
8effe95df6f0 added diff highlighting parser
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
25
8effe95df6f0 added diff highlighting parser
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
26 self.addRule("DiffSeparator", r'^(@@ .*?)$')
8effe95df6f0 added diff highlighting parser
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
27 self.addRule("DiffSeparator", r'^--- *$')
8effe95df6f0 added diff highlighting parser
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
28
8effe95df6f0 added diff highlighting parser
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
29 self.addRule("DiffAdded", r'^(\+.*?)$')
8effe95df6f0 added diff highlighting parser
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
30 self.addRule("DiffRemoved", r'^(-.*?)$')
8effe95df6f0 added diff highlighting parser
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
31 self.addRule("DiffAdded", r'^(>.*?)$')
8effe95df6f0 added diff highlighting parser
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
32 self.addRule("DiffRemoved", r'^(<.*?)$')
8effe95df6f0 added diff highlighting parser
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
33 self.addRule("DiffChanged", r'^(!.*?)$')
8effe95df6f0 added diff highlighting parser
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
34
8effe95df6f0 added diff highlighting parser
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
35 self.addRuleFormat("DiffAdded")
8effe95df6f0 added diff highlighting parser
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
36 self.addRuleFormat("DiffRemoved")
8effe95df6f0 added diff highlighting parser
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
37 self.addRuleFormat("DiffChanged")
8effe95df6f0 added diff highlighting parser
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
38 self.addRuleFormat("DiffSeparator")
8effe95df6f0 added diff highlighting parser
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
39