Documentation for this module may be created at Module:OOOFAQ/doc

local p = {}

function p.render(frame)
    local args = frame:getParent().args
    local html = mw.html.create('div')
        :addClass('ooo-faq')

    local index = 1

    while args['question' .. index] do
        local question = args['question' .. index]
        local answer = args['answer' .. index] or ''

        local item = html:tag('div')
            :addClass('mw-collapsible mw-collapsed ooo-faq__item')

        item:tag('div')
            :addClass('ooo-faq__question')
            :wikitext(question)

        item:tag('div')
            :addClass('mw-collapsible-content ooo-faq__answer')
            :wikitext(answer)

        index = index + 1
    end

    return tostring(html)
end

return p