Diff

util/stanza.lua @ 1931:f203330eb82e

util.stanza: Make xml_escape publicly accessible
author Matthew Wild <mwild1@gmail.com>
date Tue, 06 Oct 2009 18:05:31 +0100
parent 1874:262ea889016f
child 1932:af8cdbb63b13
line wrap: on
line diff
--- 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