Module:ProjectBox: Difference between revisions
From Nasqueron Agora
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..." |
No edit summary |
||
| Line 15: | Line 15: | ||
local html = {} | local html = {} | ||
-- Title | table.insert(html, '<table class="infobox project-infobox">') | ||
if args.project then | |||
table.insert(html, string.format(' | -- 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 | end | ||
-- Rows | -- Rows | ||
| Line 28: | Line 29: | ||
table.insert(html, renderRow("Participants", args.participants)) | table.insert(html, renderRow("Participants", args.participants)) | ||
table.insert(html, ' | table.insert(html, '</table>') | ||
return table.concat(html, '\n') | return table.concat(html, '\n') | ||
Revision as of 17:41, 9 April 2026
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
