#!/bin/lua gsub = string.gsub f = io.stdin if #arg ~= 0 then file = arg[1] f = io.open(file) end s = f:read("*a") -- print(s) f:close() s = gsub(s,"(<[^>]+>)","") s = gsub(s,"\n\n\n+","\n\n") conv = {[">"] = ">", ["<"] = "<", ["&"] = "&", [" "] = " "} s = gsub(s,"(&%w+;)",conv) print(s)