manfilter.lua: remove extra indent in table cells with code blocks.

This commit is contained in:
John MacFarlane 2022-01-29 15:35:37 -08:00
parent 07e79f68a7
commit 989f315a84

View file

@ -11,6 +11,30 @@ function Header(el)
end
end
-- unindent table content
function Table(el)
for _,body in ipairs(el.bodies) do
handleTableBody(body)
end
return el
end
local function handleCell(el)
if #el.contents > 0 and el.contents[1].t == "CodeBlock" then
table.insert(el.contents, 1, pandoc.RawBlock("man", ".RS -14n"))
table.insert(el.contents, pandoc.RawBlock("man", ".RE"))
end
end
function handleTableBody(el)
for _,row in ipairs(el.body) do
for _,cell in ipairs(row.cells) do
handleCell(cell)
end
end
end
-- replace links with link text
function Link(el)
return el.content