branch : pmacs2
This commit is contained in:
moculus 2008-05-06 05:23:58 +00:00
parent 8a3850da3e
commit d2492c791d
2 changed files with 15 additions and 1 deletions

View File

@ -73,6 +73,7 @@ class HTML(mode.Fundamental):
self.add_bindings('close-paren', (')',)) self.add_bindings('close-paren', (')',))
self.add_bindings('close-brace', ('}',)) self.add_bindings('close-brace', ('}',))
self.add_bindings('close-bracket', (']',)) self.add_bindings('close-bracket', (']',))
self.add_bindings('xml-create-tag', ('M-t',))
self.add_action(HtmlViewPage()) self.add_action(HtmlViewPage())
self.add_action(HtmlCheckSpelling()) self.add_action(HtmlCheckSpelling())

View File

@ -24,6 +24,16 @@ class XmlValidate(method.shell.Exec):
def _execute(self, w, **vargs): def _execute(self, w, **vargs):
self._doit(w, w.buffer.path, 'xmlwf %(path)r', cmdname='xml-validate') 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): class XML(mode.Fundamental):
modename = 'XML' modename = 'XML'
extensions = ['.xml', '.xml.in'] extensions = ['.xml', '.xml.in']
@ -38,6 +48,9 @@ class XML(mode.Fundamental):
'xml_tag.string.end': ('green', 'default', 'bold'), 'xml_tag.string.end': ('green', 'default', 'bold'),
'xml_tag.end': ('default', '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 install = XML.install