% local function escape_xml(str) return tostring(str):gsub("&", "&"):gsub("'", "'"):gsub(">", ">"):gsub("<", "<"):gsub("\"", """) end local function escape_double_quotes(str) return tostring(str):gsub("\"", """) end local function get_rgba(hex, opacity) local h = tostring(hex):gsub("#", "") return "rgba(" .. tonumber(h:sub(1, 2), 16) .. "," .. tonumber(h:sub(3, 4), 16) .. "," .. tonumber(h:sub(5, 6), 16) .. "," .. tonumber(opacity, 10) / 100 .. ")" end %>