Module:ProjectBox

From Nasqueron Agora
Revision as of 17:41, 9 April 2026 by Dereckson (talk | contribs)

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

local p = {}

local function renderRow(label, value)
    if not value or value == "" then
        return ""
    end
    return string.format(
        '<tr><th>%s</th><td>%s</td></tr>',
        label, value
    )
end

function p.render(frame)
    local args = frame:getParent().args

    local html = {}

    table.insert(html, '<table class="infobox project-infobox">')

    -- Title
    if args.project and args.project ~= "" then
        table.insert(html,
            string.format('<tr><th colspan="2" class="infobox-title">%s</th></tr>', args.project)
        )
    end

    -- Rows
    table.insert(html, renderRow("Group", args.group))
    table.insert(html, renderRow("Participants", args.participants))

    table.insert(html, '</table>')

    return table.concat(html, '\n')
end

return p