1
1
# -*- coding: iso-8859-1 -*-
3
MoinMoin - diff/patch Parser
5
DEPRECATED compatibility wrapper calling the highlight parser.
7
This is to support (deprecated) existing syntax like:
12
It is equivalent to the new way to highlight code:
13
{{{#!highlight diff ...
17
@copyright: 2008 MoinMoin:ThomasWaldmann
3
MoinMoin - Diff Parser - highlights diff tool output
5
@copyright: 2006 Emilio Lopes, inspired by previous work
6
done by Fabien Ninoles and Juergen Hermann
18
7
@license: GNU GPL, see COPYING for details.
21
from MoinMoin.parser.highlight import Parser as HighlightParser
22
from MoinMoin.parser.highlight import Dependencies
24
class Parser(HighlightParser):
25
parsername = 'diff' # Lexer name pygments recognizes
26
extensions = [] # this is only a compatibility wrapper, we have declared
27
# support for this extension in the HighlightParser, so
28
# moin will call that directly
10
from MoinMoin.parser._ParserBase import ParserBase
12
class Parser(ParserBase):
13
parsername = "ColorizedDiff"
14
extensions = ['.diff', '.patch', ]
18
ParserBase.setupRules(self)
20
self.addRule("Comment", r'^(diff .*?)$')
21
self.addRule("Comment", r'^(\*\*\* .*?)$')
22
self.addRule("Comment", r'^(--- .*?)$')
23
self.addRule("Comment", r'^(\+\+\+ .*?)$')
24
self.addRule("Comment", r'^\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* *$')
26
self.addRule("DiffSeparator", r'^(@@ .*?)$')
27
self.addRule("DiffSeparator", r'^--- *$')
29
self.addRule("DiffAdded", r'^(\+.*?)$')
30
self.addRule("DiffRemoved", r'^(-.*?)$')
31
self.addRule("DiffAdded", r'^(>.*?)$')
32
self.addRule("DiffRemoved", r'^(<.*?)$')
33
self.addRule("DiffChanged", r'^(!.*?)$')
35
self.addRuleFormat("DiffAdded")
36
self.addRuleFormat("DiffRemoved")
37
self.addRuleFormat("DiffChanged")
38
self.addRuleFormat("DiffSeparator")