Changeset

1931:f203330eb82e

util.stanza: Make xml_escape publicly accessible
author Matthew Wild <mwild1@gmail.com>
date Tue, 06 Oct 2009 18:05:31 +0100
parents 1930:92b78dd346ca
children 1932:af8cdbb63b13
files util/stanza.lua
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
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