Skip to content

Commit

Permalink
ensure uniform return types. Closes #5461.
Browse files Browse the repository at this point in the history
  • Loading branch information
cscheid committed May 9, 2023
1 parent 9750c20 commit b8730e5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/resources/filters/common/pandoc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,16 @@ function markdownToInlines(str)
end

function stripTrailingSpace(inlines)
-- we always convert to pandoc.List to ensure a uniform
-- return type (and its associated methods)
if #inlines > 0 then
if inlines[#inlines].t == "Space" then
return pandoc.List(tslice(inlines, 1, #inlines - 1))
else
return inlines
return pandoc.List(inlines)
end
else
return inlines
return pandoc.List(inlines)
end
end

Expand Down

0 comments on commit b8730e5

Please sign in to comment.