summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-02-28 22:18:44 +0100
committerGeorg Brandl <georg@python.org>2010-02-28 22:18:44 +0100
commit5b92ae2c027adbeb1ea8f759bcdbf18cf7671c4e (patch)
tree9a6b3eba4a8de43503468d48ab8241403d80b806
parentba92842a3d036b9dda0c2da75718a8ef79c795ac (diff)
downloadpygments-5b92ae2c027adbeb1ea8f759bcdbf18cf7671c4e.tar.gz
rst lexer: add substitution defs, better highlighting for directives.
-rw-r--r--CHANGES2
-rw-r--r--pygments/lexers/text.py7
2 files changed, 8 insertions, 1 deletions
diff --git a/CHANGES b/CHANGES
index dcb4e892..6c57c101 100644
--- a/CHANGES
+++ b/CHANGES
@@ -20,6 +20,8 @@ Version 1.3
* Haml and Sass
* CoffeeScript
+- Enhanced reStructuredText highlighting.
+
- Fixed a bug in `do_insertions()` used for multi-lexer languages.
- Fixed a Ruby regex highlighting bug (#476).
diff --git a/pygments/lexers/text.py b/pygments/lexers/text.py
index 97f99d4f..545702b9 100644
--- a/pygments/lexers/text.py
+++ b/pygments/lexers/text.py
@@ -660,13 +660,18 @@ class RstLexer(RegexLexer):
_handle_sourcecode),
# A directive
(r'^( *\.\.)(\s*)([\w-]+)(::)(?:([ \t]*)(.+))?',
- bygroups(Punctuation, Text, Operator.Word, Punctuation, Text, Keyword)),
+ bygroups(Punctuation, Text, Operator.Word, Punctuation, Text,
+ using(this, state='inline'))),
# A reference target
(r'^( *\.\.)(\s*)([\w\t ]+:)(.*?)$',
bygroups(Punctuation, Text, Name.Tag, using(this, state='inline'))),
# A footnote target
(r'^( *\.\.)(\s*)(\[.+\])(.*?)$',
bygroups(Punctuation, Text, Name.Tag, using(this, state='inline'))),
+ # A substitution def
+ (r'^( *\.\.)(\s*)(\|.+\|)(\s*)([\w-]+)(::)(?:([ \t]*)(.+))$',
+ bygroups(Punctuation, Text, Name.Tag, Text, Operator.Word,
+ Punctuation, Text, using(this, state='inline'))),
# Comments
(r'^ *\.\..*(\n( +.*\n|\n)+)?', Comment.Preproc),
# Field list