ThirdParty/Pygments/pygments/lexers/html.py

changeset 4697
c2e9bf425554
parent 4172
4f20dba37ab6
child 5713
6762afd9f963
diff -r bf4d19a7cade -r c2e9bf425554 ThirdParty/Pygments/pygments/lexers/html.py
--- a/ThirdParty/Pygments/pygments/lexers/html.py	Sun Jan 24 16:15:58 2016 +0100
+++ b/ThirdParty/Pygments/pygments/lexers/html.py	Sun Jan 24 19:28:37 2016 +0100
@@ -5,7 +5,7 @@
 
     Lexers for HTML, XML and related markup.
 
-    :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
+    :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
     :license: BSD, see LICENSE for details.
 """
 
@@ -46,12 +46,19 @@
             ('<!--', Comment, 'comment'),
             (r'<\?.*?\?>', Comment.Preproc),
             ('<![^>]*>', Comment.Preproc),
-            (r'<\s*script\s*', Name.Tag, ('script-content', 'tag')),
-            (r'<\s*style\s*', Name.Tag, ('style-content', 'tag')),
+            (r'(<)(\s*)(script)(\s*)',
+             bygroups(Punctuation, Text, Name.Tag, Text),
+             ('script-content', 'tag')),
+            (r'(<)(\s*)(style)(\s*)',
+             bygroups(Punctuation, Text, Name.Tag, Text),
+             ('style-content', 'tag')),
             # note: this allows tag names not used in HTML like <x:with-dash>,
             # this is to support yet-unknown template engines and the like
-            (r'<\s*[\w:.-]+', Name.Tag, 'tag'),
-            (r'<\s*/\s*[\w:.-]+\s*>', Name.Tag),
+            (r'(<)(\s*)([\w:.-]+)',
+             bygroups(Punctuation, Text, Name.Tag), 'tag'),
+            (r'(<)(\s*)(/)(\s*)([\w:.-]+)(\s*)(>)',
+             bygroups(Punctuation, Text, Punctuation, Text, Name.Tag, Text,
+                      Punctuation)),
         ],
         'comment': [
             ('[^-]+', Comment),
@@ -60,16 +67,21 @@
         ],
         'tag': [
             (r'\s+', Text),
-            (r'([\w:-]+\s*=)(\s*)', bygroups(Name.Attribute, Text), 'attr'),
+            (r'([\w:-]+\s*)(=)(\s*)', bygroups(Name.Attribute, Operator, Text),
+             'attr'),
             (r'[\w:-]+', Name.Attribute),
-            (r'/?\s*>', Name.Tag, '#pop'),
+            (r'(/?)(\s*)(>)', bygroups(Punctuation, Text, Punctuation), '#pop'),
         ],
         'script-content': [
-            (r'<\s*/\s*script\s*>', Name.Tag, '#pop'),
+            (r'(<)(\s*)(/)(\s*)(script)(\s*)(>)',
+             bygroups(Punctuation, Text, Punctuation, Text, Name.Tag, Text,
+                      Punctuation), '#pop'),
             (r'.+?(?=<\s*/\s*script\s*>)', using(JavascriptLexer)),
         ],
         'style-content': [
-            (r'<\s*/\s*style\s*>', Name.Tag, '#pop'),
+            (r'(<)(\s*)(/)(\s*)(style)(\s*)(>)',
+             bygroups(Punctuation, Text, Punctuation, Text, Name.Tag, Text,
+                      Punctuation),'#pop'),
             (r'.+?(?=<\s*/\s*style\s*>)', using(CssLexer)),
         ],
         'attr': [

eric ide

mercurial