view MoinMoin/parser/text_diff.py @ 2277:5638ffa2fb38

replace crlf in python src files by lf
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 02 Jul 2007 16:23:12 +0200
parents bb2e053067fb
children e25b00b3a308
line wrap: on
line source
# -*- coding: iso-8859-1 -*-
"""
    MoinMoin - Diff Parser - highlights diff tool output

    @copyright: 2006 Emilio Lopes, inspired by previous work
                done by Fabien Ninoles and Juergen 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")