fabriquedoc-backend/centered.lua

29 lines
No EOL
671 B
Lua

-- centered.lua
-- Copyright (c) bpj on GitHub
-- https://github.com/jgm/pandoc/issues/719#issuecomment-922019826
-- GPL-2+ license
local center_for = {
latex = {
pre = pandoc.RawBlock('latex', '\\begin{center}'),
post = pandoc.RawBlock('latex', '\\end{center}'),
},
-- add more as needed...
}
function Div (div)
if div.classes:includes('center') then
if center_for[FORMAT] then
local rv = {}
if center_for[FORMAT].pre then
rv[#rv+1] = center_for[FORMAT].pre
end
rv[#rv+1] = div
if center_for[FORMAT].post then
rv[#rv+1] = center_for[FORMAT].post
end
return rv
end
end
return nil
end