diff options
author | ubq323 <ubq323@ubq323.website> | 2024-11-06 00:07:16 +0000 |
---|---|---|
committer | ubq323 <ubq323@ubq323.website> | 2024-11-06 00:07:39 +0000 |
commit | 6d29e83effd717a1938859df15ab6f03801d363a (patch) | |
tree | 32969141282dc26aa32e8b720f5891e82fd978ba /html.lua | |
parent | 9d75a4bff7160403d62c1f0b1bee101afb496d1f (diff) |
Diffstat (limited to 'html.lua')
-rw-r--r-- | html.lua | 12 |
1 files changed, 2 insertions, 10 deletions
@@ -19,14 +19,10 @@ local html local function fmt_tag(tag) local attrs = tag.attrs and fmt_attrs(tag.attrs) or "" local selfclosing = (tag.body == "") - local sameline = type(tag.body) == "string" - or (type(tag.body) == "table" and tag.body.tag) - or (type(tag.body) == "table" and #tag.body <= 1) - local maybenl = sameline and "" or "\n" if selfclosing then return ("<%s%s/>"):format(tag.tname,attrs) else - return ("<%s%s>%s%s</%s>"):format(tag.tname,attrs,maybenl,html(tag.body),tag.tname) + return ("<%s%s>%s</%s>"):format(tag.tname,attrs,html(tag.body),tag.tname) end end @@ -72,13 +68,9 @@ html = function (x) return safe( tostring(x) ) else -- just a regular list - local nl = "\n" - if #x <= 2 then - nl = "" - end local o = "" for _,item in ipairs(x) do - o = o .. tostring(html(item)) .. nl + o = o .. tostring(html(item)) end return safe(o) end |