#!/bin/lua pre = 0 if arg[1] == "-p" then pre = 1 table.remove(arg,1) end function conv(s) s = string.gsub(s,"&","&") s = string.gsub(s,"<","<") s = string.gsub(s,">",">") if pre == 0 then s = string.gsub(s," "," ") s = string.gsub(s,"\n","
\n") print("

"..s.."

\n") else print(s) end end if #arg ~= 0 then io.input(arg[1]) end p = "" for line in io.lines() do line = string.gsub(line," +$","") if #line > 0 then if #p > 0 then p = p.."\n"..line else p = line end elseif #p > 0 then conv(p) p = "" end end if #p > 0 then conv(p) end