summaryrefslogtreecommitdiffstats
path: root/filters/macros.lua
blob: 86e94ba16bb5c52db38acf816513d9a87932f2d0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function Div(el)
    if el.attributes.macro == nil then
        return el
    end

    if el.attributes.macro == 'refs' and el.content[1].tag == 'BulletList' then
        local newchildren = pandoc.List()

        newchildren:insert(pandoc.RawBlock('html', '<ul>'))

        for k, children in ipairs(el.content[1].content) do
            newchildren:insert(pandoc.RawBlock('html', '<li class="c-page__prefixed c-page__prefixed--ref">'))
            newchildren:extend(children)
            newchildren:insert(pandoc.RawBlock('html', '</li>'))
        end

        newchildren:insert(pandoc.RawBlock('html', '</ul>'))

        el.content = newchildren
    end

    return el.content
end