--Characters to escape in the body text
local escapes = {
["&"] = "&",
["<"] = "<",
[">"] = ">",
['"'] = """,
["'"] = "'",
--Kinda hacky
["\n"] = "
",
}
local esctbl = {}
for char,_ in pairs(escapes) do
table.insert(esctbl,char)
end
local escapematch = string.format("([%s])",table.concat(esctbl))
local function sanitize(capture)
return escapes[capture] or capture
end
return function(text)
text = string.gsub(text,escapematch,sanitize)
--text = string.gsub(text,"\n\n","
") return text end