branch : pmacs2
This commit is contained in:
moculus 2008-10-16 01:38:49 +00:00
parent f4b1044911
commit 92cd22884a
1 changed files with 15 additions and 13 deletions

View File

@ -9,13 +9,8 @@ class RSTString(Grammar):
class RSTGrammar(Grammar): class RSTGrammar(Grammar):
rules = [ rules = [
PatternGroupRule(r'title', r'title_over', r'^=+\n', r'title', r'^.*?\n', PatternRule(r'title', r'^=+\n$'),
r'title_under', r'^=+\n'), PatternRule(r'subtitle', r'^-+\n$'),
PatternGroupRule(r'title', r'title', r'^.*?\n', r'title_under', r'^=+\n'),
PatternGroupRule(r'subtitle', r'subtitle_over', r'^-+\n', r'subtitle',
r'^.*?\n', r'subtitle_under', r'^-+\n'),
PatternGroupRule(r'subtitle', r'subtitle', r'^.*?\n', r'subtitle_under',
r'^-+\n'),
# this is kind of a hack, ugh # this is kind of a hack, ugh
PatternGroupRule(r'definition', r'term', r'^[^ ]+\n', r'definition', r'^ +'), PatternGroupRule(r'definition', r'term', r'^[^ ]+\n', r'definition', r'^ +'),
@ -26,6 +21,9 @@ class RSTGrammar(Grammar):
RegionRule(r'blocktest', r'>>>', Grammar, '^\n'), RegionRule(r'blocktest', r'>>>', Grammar, '^\n'),
PatternRule(r'transition', r'^[-=.,;]{4,}\n'), PatternRule(r'transition', r'^[-=.,;]{4,}\n'),
#OverridePatternRule(r'comment', r'#@@:(?P<token>[.a-zA-Z0-9_]+):(?P<mode>[.a-zA-Z0-9_]+) *$'),
#OverridePatternRule(r'code', r'^\.\. code-block:: (?P<mode>:.+)\n$'),
RegionRule(r'emphasis', r'\*', RSTString, r'\*'), RegionRule(r'emphasis', r'\*', RSTString, r'\*'),
RegionRule(r'strong_emphasis', r'\*\*', RSTString, r'\*\*'), RegionRule(r'strong_emphasis', r'\*\*', RSTString, r'\*\*'),
RegionRule(r'interpreted', r'`', RSTString, r'`'), RegionRule(r'interpreted', r'`', RSTString, r'`'),
@ -53,11 +51,11 @@ class RST(mode.Fundamental):
grammar = RSTGrammar grammar = RSTGrammar
colors = { colors = {
'title': ('blue', 'default', 'bold'), 'title': ('blue', 'default', 'bold'),
'title_over': ('blue', 'default', 'bold'), #'title_over': ('blue', 'default', 'bold'),
'title_under': ('blue', 'default', 'bold'), #'title_under': ('blue', 'default', 'bold'),
'subtitle': ('cyan', 'default', 'bold'), 'subtitle': ('cyan', 'default', 'bold'),
'subtitle_over': ('cyan', 'default', 'bold'), #'subtitle_over': ('cyan', 'default', 'bold'),
'subtitle_under': ('cyan', 'default', 'bold'), #'subtitle_under': ('cyan', 'default', 'bold'),
'definition': ('green', 'default', 'bold'), 'definition': ('green', 'default', 'bold'),
'fieldname': ('green', 'default', 'bold'), 'fieldname': ('green', 'default', 'bold'),
@ -67,8 +65,12 @@ class RST(mode.Fundamental):
'blocktest': ('cyan', 'default', 'bold'), 'blocktest': ('cyan', 'default', 'bold'),
'transition': ('cyan', 'default', 'bold'), 'transition': ('cyan', 'default', 'bold'),
'emphasis': ('red', 'default', 'bold'), 'emphasis.start': ('red', 'default', 'bold'),
'strong_emphasis': ('red', 'default', 'bold'), 'emphasis.null': ('red', 'default', 'bold'),
'emphasis.end': ('red', 'default', 'bold'),
'strong_emphasis.start': ('red', 'default', 'bold'),
'strong_emphasis.null': ('red', 'default', 'bold'),
'strong_emphasis.end': ('red', 'default', 'bold'),
'interpreted': ('magenta', 'default', 'bold'), 'interpreted': ('magenta', 'default', 'bold'),
'inline_literal': ('magenta', 'default', 'bold'), 'inline_literal': ('magenta', 'default', 'bold'),
'substitution': ('magenta', 'default', 'bold'), 'substitution': ('magenta', 'default', 'bold'),