diff --git a/mode/html.py b/mode/html.py
index b498e3b..0b95f56 100644
--- a/mode/html.py
+++ b/mode/html.py
@@ -15,6 +15,7 @@ class HTMLGrammar(Grammar):
RegionRule(r'script', r'<(?=script[^a-zA-Z0-9_])', TagGrammar, r'>', JavascriptGrammar, r'(?=script>)', TagGrammar, r'>'),
RegionRule(r'style', r'<(?=style[^a-zA-Z0-9_])', TagGrammar, r'>', CSSGrammar, r'(?=style>)', TagGrammar, r'>'),
RegionRule(r'tag', r'?', TagGrammar, r'/?>'),
+ PatternRule(r'entity', r'&.*?;'),
]
class HtmlViewPage(method.Method):
@@ -48,7 +49,9 @@ class HTML(mode.Fundamental):
modename = 'HTML'
extensions = ['.html', '.htm', '.shtml', '.shtm', '.xhtml']
grammar = HTMLGrammar
- colors = {}
+ colors = {
+ 'entity': ('magenta', 'default', 'bold'),
+ }
config = {
'html.viewcmd': 'firefox&',
}
diff --git a/mode/xml.py b/mode/xml.py
index 36b983f..1866fc3 100644
--- a/mode/xml.py
+++ b/mode/xml.py
@@ -15,6 +15,7 @@ class XMLGrammar(Grammar):
# TODO: how does cdata work again?
RegionRule(r'comment', r''),
RegionRule(r'xml_tag', r'<', TagGrammar, r'/?>'),
+ PatternRule(r'xml_entity', r'&.*?;'),
]
class XmlValidate(method.shell.Exec):
@@ -47,6 +48,7 @@ class XML(mode.Fundamental):
'xml_tag.string.null': ('green', 'default', 'bold'),
'xml_tag.string.end': ('green', 'default', 'bold'),
'xml_tag.end': ('default', 'default', 'bold'),
+ 'xml_entity': ('magenta', 'default', 'bold'),
}
actions = [XmlValidate, XmlCreateTag]
def __init__(self, w):