util.stanza: Make xml_escape publicly accessible

Tue, 06 Oct 2009 18:05:31 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Tue, 06 Oct 2009 18:05:31 +0100
changeset 1931
f203330eb82e
parent 1930
92b78dd346ca
child 1932
af8cdbb63b13

util.stanza: Make xml_escape publicly accessible

util/stanza.lua file | annotate | diff | comparison | revisions
--- a/util/stanza.lua	Tue Oct 06 15:02:16 2009 +0100
+++ b/util/stanza.lua	Tue Oct 06 18:05:31 2009 +0100
@@ -118,10 +118,13 @@
 	                                    
 end
 
-local xml_escape = (function()
+local xml_escape
+do
 	local escape_table = { ["'"] = "&apos;", ["\""] = "&quot;", ["<"] = "&lt;", [">"] = "&gt;", ["&"] = "&amp;" };
-	return function(str) return (s_gsub(str, "['&<>\"]", escape_table)); end
-end)();
+	function xml_escape(str) return (s_gsub(str, "['&<>\"]", escape_table)); end
+	_M.xml_escape = xml_escape;
+end
+
 local function _dostring(t, buf, self, xml_escape)
 	local nsid = 0;
 	local name = t.name

mercurial