Module:ProjectBox

From Nasqueron Agora
Revision as of 17:38, 9 April 2026 by Dereckson (talk | contribs) (Created page with "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, '{| class="infobox project-infobox"') -- Title (project name) if args.project then table.insert(html, string.format('! colspan="2" c...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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, '{| class="infobox project-infobox"')

    -- Title (project name)
    if args.project then
        table.insert(html, string.format('! colspan="2" class="infobox-title" | %s', args.project))
    end

    table.insert(html, '|-')

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

    table.insert(html, '|}')

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

return p