diff --git a/man/manfilter.lua b/man/manfilter.lua index c6bbd02c4..dd1a9ab56 100644 --- a/man/manfilter.lua +++ b/man/manfilter.lua @@ -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