parent
185ee1a061
commit
701728fbd9
|
@ -0,0 +1,14 @@
|
|||
From: Erik Osheim <erik@osheim.org>
|
||||
To: All Systems Go! <systems@solutionsforprogress.com>
|
||||
Date: Wednesday, April 8th 2009
|
||||
Subject: Ahoy!
|
||||
|
||||
Quoth Alec Wood <awood@solutionsforprogress.com>:
|
||||
> I got this crazy email; here it is:
|
||||
>
|
||||
> Also sprach Emily Record <erecord@solutionsforprogress.com>:
|
||||
>> This is double-quoted:
|
||||
>>
|
||||
>>> Hi there!!!
|
||||
|
||||
This is outer text.
|
31
mode/mutt.py
31
mode/mutt.py
|
@ -1,29 +1,30 @@
|
|||
import re
|
||||
import color, mode, method
|
||||
import mode.text
|
||||
from mode import Fundamental
|
||||
from method import WrapParagraph
|
||||
from mode.text import ContinuedRule, WordRule, TextInsertSpace
|
||||
from lex import Grammar, PatternRule
|
||||
|
||||
class MuttGrammar(Grammar):
|
||||
rules = [
|
||||
PatternRule(name=r'mutt_header', pattern=r'^(?:From|To|Cc|Bcc|Subject|Reply-To|In-Reply-To|Delivered-To|Date):'),
|
||||
PatternRule(name=r'quoteb', pattern=r'^ *(?:(?: *>){3})*(?: *>){2}.*$'),
|
||||
PatternRule(name=r'quotea', pattern=r'^ *(?:(?: *>){3})*(?: *>){1}.*$'),
|
||||
PatternRule(name=r'quotec', pattern=r'^ *(?:(?: *>){3})*(?: *>){3}.*$'),
|
||||
PatternRule(name=r'email', pattern=r'(?:^|(?<=[ :]))<?[^<>@\n ]+@(?:[^<>@\.\n ]+\.)*[^<>@\.\n ]+>?'),
|
||||
PatternRule(name=r'url', pattern=r'(?:^|(?<= ))(?:http|https|ftp|sftp|file|smtp|smtps|torrent|news|jabber|irc|telnet)://(?:[^\.\n ]+\.)*[^\.\n ]+'),
|
||||
mode.text.ContinuedRule(),
|
||||
mode.text.WordRule(),
|
||||
PatternRule(name=r'punct', pattern=r'[^a-zA-Z0-9_]'),
|
||||
PatternRule(name=r'stuff', pattern=r'[a-zA-Z0-9_]+'),
|
||||
PatternRule('mutt_header', '^(?:From|To|Cc|Bcc|Subject|Reply-To|In-Reply-To|Delivered-To|Date):'),
|
||||
PatternRule('quotec', '^ *(?:(?: *>){3})*(?: *>){3}.*$'),
|
||||
PatternRule('quoteb', '^ *(?:(?: *>){3})*(?: *>){2}.*$'),
|
||||
PatternRule('quotea', '^ *(?:(?: *>){3})*(?: *>){1}.*$'),
|
||||
PatternRule('email', r'(?:^|(?<=[ :]))<?[^<>@\n ]+@(?:[^<>@\.\n ]+\.)*[^<>@\.\n ]+>?'),
|
||||
PatternRule('url', r'(?:^|(?<= ))(?:http|https|ftp|sftp|file|smtp|smtps|torrent|news|jabber|irc|telnet)://(?:[^\.\n ]+\.)*[^\.\n ]+'),
|
||||
ContinuedRule(),
|
||||
WordRule(),
|
||||
PatternRule('punct', '[^a-zA-Z0-9_]'),
|
||||
PatternRule('stuff', '[a-zA-Z0-9_]+'),
|
||||
]
|
||||
|
||||
class MuttWrapParagraph(method.WrapParagraph):
|
||||
class MuttWrapParagraph(WrapParagraph):
|
||||
limit = 72
|
||||
empty_re = re.compile('^(?: *>.*| *)$')
|
||||
class MuttInsertSpace(mode.text.TextInsertSpace):
|
||||
class MuttInsertSpace(TextInsertSpace):
|
||||
wrapper = MuttWrapParagraph
|
||||
|
||||
class Mutt(mode.Fundamental):
|
||||
class Mutt(Fundamental):
|
||||
name = 'Mutt'
|
||||
grammar = MuttGrammar()
|
||||
colors = {
|
||||
|
|
Loading…
Reference in New Issue