Add files via upload
Kevgeon - Brandon [07-11-17 - 03:37]
Add files via upload
This version works better
diff --git a/autotag2.lua b/autotag2.lua
new file mode 100644
index 0000000..6998f2d
--- /dev/null
+++ b/autotag2.lua
@@ -0,0 +1,23 @@
+return {
+ name = "Autotag for xml",
+ description = "Auto-enters closing tags for xml",
+ author = "Brandon Wall @Solvaring",
+ version = 0.1,
+ onEditorCharAdded = function(self, editor, event)
+ local tag = editor:GetCurLine()
+ local curkey = event:GetKey()
+ local curpos = editor:GetCurrentPos()
+ if curkey == 62 and tag:find("%b<>") then
+ if tag:find([[</]]) then
+ goto breakout
+ end
+ if tag:find([[<[%w%d%s"'=]+/>]]) then
+ goto breakout
+ end
+ local tagtoclose = tag:match("<([%a%d]+)")
+ editor:AddText("</"..tagtoclose..">")
+ ::breakout::
+ end
+ end
+
+}
\ No newline at end of file