Fandom Developers Wiki
Documentation icon Module documentation

The documentation for this module is missing. Click here to create it.

local p = {}

local title = mw.title.getCurrentTitle()

function p.main(frame)
    local args = frame:getParent().args
    local contents = {
        ''
    }
    if args[1] then
        table.insert(contents, '<div style="font-size: larger;clear:both"><u>')
        table.insert(contents, mw.text.trim(args[1]))
        table.insert(contents, '</u></div>')
    end
    for k, v in ipairs(args) do
        local i = tonumber(k)
        if i and v and i > 1 then
            i = i - 2
            if i % 2 == 0 then
                table.insert(contents, '<dt style="font-size:small">')
                table.insert(contents, mw.text.trim(v))
                table.insert(contents, '</dt>')
            else
                local r = mw.ustring.gsub(mw.text.trim(v), table.concat({' ', args.separator or '!', ' '}), ' • ')
                table.insert(contents, '<div style="font-size:small;">')
                table.insert(contents, mw.text.trim(r))
                table.insert(contents, '</div>')
            end
        end
    end
    contents = table.concat(contents)
    if
        title.namespace ~= 829 or
        title.subpageText ~= 'testcases'
    then
        contents = frame:preprocess(contents)
    end
    return contents
end

return p