33 lines
880 B
Lua
33 lines
880 B
Lua
-- Keep YAML author/title for print-chrome.lua injection,
|
|
-- but strip Quarto's visible title block (we render our own for PDF;
|
|
-- screen readers still get the document <title>).
|
|
function Meta(meta)
|
|
if quarto.doc.is_format("html") then
|
|
meta.author = nil
|
|
meta["by-author"] = nil
|
|
end
|
|
return meta
|
|
end
|
|
|
|
function Pandoc(doc)
|
|
if not quarto.doc.is_format("html") then
|
|
return doc
|
|
end
|
|
-- Drop Pandoc title-block header nodes if present in blocks
|
|
local out = {}
|
|
for _, block in ipairs(doc.blocks) do
|
|
local skip = false
|
|
if block.t == "Header" and block.level == 1 and doc.meta.title ~= nil then
|
|
local title = pandoc.utils.stringify(doc.meta.title)
|
|
if pandoc.utils.stringify(block.content) == title then
|
|
skip = true
|
|
end
|
|
end
|
|
if not skip then
|
|
table.insert(out, block)
|
|
end
|
|
end
|
|
doc.blocks = out
|
|
return doc
|
|
end
|