Skip to content

Commit

Permalink
fix: Soft breaks may leave multiple spaces in the output
Browse files Browse the repository at this point in the history
  • Loading branch information
Omikhleia authored and Didier Willis committed Aug 21, 2023
1 parent eaf50a9 commit 16cedf8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion inputters/djot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,16 @@ function Renderer:render_children(node)
self.tight = node.tight
end
for i=1,#node.c do
out[#out+1] = self[node.c[i].t](self, node.c[i])
local content = self[node.c[i].t](self, node.c[i])
-- Simplify outputs by collating strings
if type(content) == "string" and type(out[#out]) == "string" then
out[#out] = out[#out] .. content
else
-- Simplify out by removing empty elements
if type(content) ~= "table" or content.command or #content > -1 then
out[#out+1] = content
end
end
end
if node.tight ~= nil then
self.tight = oldtight
Expand Down

0 comments on commit 16cedf8

Please sign in to comment.