csl-clio/Utilitaires/changelog-dans-annexes.lua
2022-01-15 21:55:15 +01:00

22 lines
554 B
Lua

local CHANGELOG_PATH = '../CHANGELOG.md'
local ANNEXES_HEADER_LEVEL = 1
local shift_headings = {
Header = function(header)
header.level = header.level + ANNEXES_HEADER_LEVEL
header.classes:insert('unnumbered')
return header
end
}
function Div (div)
if div.classes:includes('changelog', 1) then
local changelog = io.open(CHANGELOG_PATH):read('a')
local changelog_doc = pandoc.read(changelog)
local to_include = pandoc.walk_block(pandoc.Div(changelog_doc.blocks), shift_headings).content
return to_include
end
end