view MoinMoin/parser/ @ 3077:66d35649ca99

add 'percent' kw to getText (must be True when using result as left side of % operator), refactored some code, better comments (ported from 1.6)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Fri, 22 Feb 2008 22:35:46 +0100
parents 5638ffa2fb38
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):

        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'^(!.*?)$')