parent
815adf18fc
commit
9b6659c7b9
|
@ -1,12 +1,8 @@
|
|||
<foo some_attr='blah'
|
||||
other_attr='foo'
|
||||
c='9'>
|
||||
<bijj a="222"
|
||||
b="999">
|
||||
<blah
|
||||
a='1'
|
||||
b='2'
|
||||
c='3' />
|
||||
<bijj a="222" b="999">
|
||||
<blah a='1' b='2' c='3' />
|
||||
fjjgg
|
||||
</bar>
|
||||
</bijj>
|
||||
</foo>
|
||||
|
|
10
mode/xml.py
10
mode/xml.py
|
@ -1,4 +1,4 @@
|
|||
import color, mode
|
||||
import color, method, mode
|
||||
from lex import Grammar, PatternRule, RegionRule
|
||||
|
||||
class TagGrammar(Grammar):
|
||||
|
@ -17,6 +17,13 @@ class XMLGrammar(Grammar):
|
|||
RegionRule(r'xml_tag', r'<', TagGrammar, r'/?>'),
|
||||
]
|
||||
|
||||
class XmlValidate(method.shell.Exec):
|
||||
'''Valid the buffer's contents as valid XML.'''
|
||||
show_success = True
|
||||
args = []
|
||||
def _execute(self, w, **vargs):
|
||||
self._doit(w, w.buffer.path, 'xmlwf %(path)r', cmdname='xml-validate')
|
||||
|
||||
class XML(mode.Fundamental):
|
||||
modename = 'XML'
|
||||
extensions = ['.xml', '.xml.in']
|
||||
|
@ -31,5 +38,6 @@ class XML(mode.Fundamental):
|
|||
'xml_tag.string.end': ('green', 'default'),
|
||||
'xml_tag.end': ('default', 'default'),
|
||||
}
|
||||
actions = [XmlValidate]
|
||||
|
||||
install = XML.install
|
||||
|
|
Loading…
Reference in New Issue