parent
8a3850da3e
commit
d2492c791d
|
@ -73,6 +73,7 @@ class HTML(mode.Fundamental):
|
|||
self.add_bindings('close-paren', (')',))
|
||||
self.add_bindings('close-brace', ('}',))
|
||||
self.add_bindings('close-bracket', (']',))
|
||||
self.add_bindings('xml-create-tag', ('M-t',))
|
||||
self.add_action(HtmlViewPage())
|
||||
self.add_action(HtmlCheckSpelling())
|
||||
|
||||
|
|
15
mode/xml.py
15
mode/xml.py
|
@ -24,6 +24,16 @@ class XmlValidate(method.shell.Exec):
|
|||
def _execute(self, w, **vargs):
|
||||
self._doit(w, w.buffer.path, 'xmlwf %(path)r', cmdname='xml-validate')
|
||||
|
||||
class XmlCreateTag(method.Method):
|
||||
''''''
|
||||
args = [method.Argument('tagname', prompt="Tag Name: ", help="Create an open/close tag pair")]
|
||||
def _execute(self, w, **vargs):
|
||||
t = vargs['tagname']
|
||||
w.insert_string_at_cursor("<%s>" % t)
|
||||
p = w.logical_cursor()
|
||||
w.insert_string_at_cursor("</%s>" % t)
|
||||
w.goto(p)
|
||||
|
||||
class XML(mode.Fundamental):
|
||||
modename = 'XML'
|
||||
extensions = ['.xml', '.xml.in']
|
||||
|
@ -38,6 +48,9 @@ class XML(mode.Fundamental):
|
|||
'xml_tag.string.end': ('green', 'default', 'bold'),
|
||||
'xml_tag.end': ('default', 'default', 'bold'),
|
||||
}
|
||||
actions = [XmlValidate]
|
||||
actions = [XmlValidate, XmlCreateTag]
|
||||
def __init__(self, w):
|
||||
mode.Fundamental.__init__(self, w)
|
||||
self.add_bindings('xml-create-tag', ('M-t',))
|
||||
|
||||
install = XML.install
|
||||
|
|
Loading…
Reference in New Issue