summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-03-01 13:52:31 +0100
committerGeorg Brandl <georg@python.org>2010-03-01 13:52:31 +0100
commit4063e5de23941be657d24bb6c74e89aa84afda11 (patch)
tree7551a7288b532792679ce7930038086a90b32c11
parent79d584cfac8d201266e3e0c343743905d7f0616c (diff)
downloadpygments-4063e5de23941be657d24bb6c74e89aa84afda11.tar.gz
Allow colons in rst directive/role names.
-rw-r--r--pygments/lexers/text.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/pygments/lexers/text.py b/pygments/lexers/text.py
index 2a361a95..55b590fe 100644
--- a/pygments/lexers/text.py
+++ b/pygments/lexers/text.py
@@ -663,7 +663,7 @@ class RstLexer(RegexLexer):
r'(\n[ \t]*\n)([ \t]+)(.*)(\n)((?:(?:\8.*|)\n)+)',
_handle_sourcecode),
# A directive
- (r'^( *\.\.)(\s*)([\w-]+)(::)(?:([ \t]*)(.*))',
+ (r'^( *\.\.)(\s*)([\w:-]+?)(::)(?:([ \t]*)(.*))',
bygroups(Punctuation, Text, Operator.Word, Punctuation, Text,
using(this, state='inline'))),
# A reference target
@@ -673,7 +673,7 @@ class RstLexer(RegexLexer):
(r'^( *\.\.)(\s*)(\[.+\])(.*?)$',
bygroups(Punctuation, Text, Name.Tag, using(this, state='inline'))),
# A substitution def
- (r'^( *\.\.)(\s*)(\|.+\|)(\s*)([\w-]+)(::)(?:([ \t]*)(.*))',
+ (r'^( *\.\.)(\s*)(\|.+\|)(\s*)([\w:-]+?)(::)(?:([ \t]*)(.*))',
bygroups(Punctuation, Text, Name.Tag, Text, Operator.Word,
Punctuation, Text, using(this, state='inline'))),
# Comments
@@ -695,9 +695,9 @@ class RstLexer(RegexLexer):
(r'(`.+?)(<.+?>)(`__?)', # reference with inline target
bygroups(String, String.Interpol, String)),
(r'`.+?`__?', String), # reference
- (r'(`.+?`)(:[a-zA-Z0-9-]+?:)?',
+ (r'(`.+?`)(:[a-zA-Z0-9:-]+?:)?',
bygroups(Name.Variable, Name.Attribute)), # role
- (r'(:[a-zA-Z0-9-]+?:)(`.+?`)',
+ (r'(:[a-zA-Z0-9:-]+?:)(`.+?`)',
bygroups(Name.Attribute, Name.Variable)), # role (content first)
(r'\*\*.+?\*\*', Generic.Strong), # Strong emphasis
(r'\*.+?\*', Generic.Emph), # Emphasis