aboutsummaryrefslogtreecommitdiff
path: root/man/manfilter.lua
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2022-01-29 15:35:37 -0800
committerJohn MacFarlane <[email protected]>2022-01-29 15:35:37 -0800
commit989f315a84bb17535d50f60b754acbf7bd969b8b (patch)
tree7ca6a6ce25b0abb9cbeb13d1e3185b039e463f94 /man/manfilter.lua
parent07e79f68a7d1593396907fd65ad3040b907f5db0 (diff)
manfilter.lua: remove extra indent in table cells with code blocks.
Diffstat (limited to 'man/manfilter.lua')
-rw-r--r--man/manfilter.lua24
1 files changed, 24 insertions, 0 deletions
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