Tue, 06 Oct 2009 18:05:31 +0100
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 = { ["'"] = "'", ["\""] = """, ["<"] = "<", [">"] = ">", ["&"] = "&" }; - 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