function HTML_ToText (text) -- Declare variables, load the file. Make tags lowercase. text = string.gsub (text,"(%b<>)", function (tag) return tag:lower() end) --[[ First we kill the developer formatting (tabs, CR, LF) and produce a long string with no newlines and tabs. We also kill repeated spaces as browsers ignore them anyway. ]] local devkill= { ["("..string.char(10)..")"] = " ", ["("..string.char(13)..")"] = " ", ["("..string.char(15)..")"] = "", ["(%s%s+)"]=" ", } for pat, res in pairs (devkill) do text = string.gsub (text, pat, res) end -- Then we remove the header. We do this by stripping it first. text = string.gsub (text, "(<%s*head[^>]*>)", "") text = string.gsub (text, "(<%s*%/%s*head%s*>)", "") text = string.gsub (text, "(,*<%/head>)", "") -- Kill all scripts. First we nuke their attribs. text = string.gsub (text, "(<%s*script[^>]*>)", "") text = string.gsub (text, "(