# HG changeset patch # User Matthew Wild # Date 1254848731 -3600 # Node ID f203330eb82e00f2cae081711d30ba5dd470c776 # Parent 92b78dd346cadbb6618bb87a8b19150ea6abc0bb util.stanza: Make xml_escape publicly accessible diff -r 92b78dd346ca -r f203330eb82e util/stanza.lua --- 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 = { ["'"] = "'", ["\""] = """, ["<"] = "<", [">"] = ">", ["&"] = "&" }; - 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