summaryrefslogtreecommitdiff
path: root/filters/section-numbers.lua
blob: 04c168ddf68991e026bfa946841941743f68284e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
sections_count = 0

if FORMAT:match 'html' then
    function Header(el)

        if not (el.level == 2) then
            return el
        end
        local numb = pandoc.Str(tostring(sections_count + 1)..".")
        sections_count = sections_count + 1
        local new_cont = {numb, pandoc.Space()}
        for i,v in ipairs(el.content) do
            new_cont[i+2]=el.content[i]
        end
        el.content = new_cont
        return el
    end
end