Module:TemplateData
From Vintage Story Wiki
Documentation for this module may be created at Module:TemplateData/doc
local p = {}
function p.main(f)
local args = require( 'Module:ProcessArgs' ).merge( true )
local rows = {}
for i=1, #test.params, 1 do
local label = test.params[i].label or test.params[i].name
local aliases = '<code>' .. test.params[i].name .. '</code>'
local description = test.params[i].description or '<i>No description</i>'
local type = test.params[i].type or '<i>Unknown</i>'
local status = 'optional'
if test.params.aliases then
for i=1, #test.params.aliases, 1 do
aliases = aliases .. '<code>' .. test.params.aliases[i] .. '</code>'
end
end
if test.params[i].required then status = '<b>required</b>'
elseif test.params[i].suggested then status = 'suggested' end
local row = '<tr><th style="font-weight: normal;">' .. label .. '</th><td>' .. aliases .. '</td><td>' .. description .. '</td><td>' .. type .. '</td><td>' .. status .. '</td></tr>'
table.insert(rows, row)
end
local body = {
'<table class="wikitable" style="margin:2em">',
'<caption>Template parameters</caption>',
'<tr>',
'<th colspan="2">Parameter</th><th>Description</th><th>Type</th><th>Status</th>',
'</tr>'
}
body = table.concat(body, '\n') .. table.concat(rows, '\n') .. '</table>'
return body
end
return p