#!/bin/lua function conv(s) s = string.gsub(s,"&","&") s = string.gsub(s,"<","<") s = string.gsub(s,">",">") s = string.gsub(s," "," ") s = string.gsub(s,"\n","<br>\n") print("<p>"..s.."</p>\n") 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