some improvements to HTML/XML mode(s)

--HG--
branch : pmacs2
This commit is contained in:
moculus 2008-05-06 06:03:47 +00:00
parent d2492c791d
commit 7b29059a56
2 changed files with 6 additions and 1 deletions

View File

@ -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&',
}

View File

@ -15,6 +15,7 @@ class XMLGrammar(Grammar):
# TODO: how does cdata work again?
RegionRule(r'comment', r'<!--', Grammar, 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):