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