Module:CareerList: Difference between revisions
Content deleted Content added
PeaceDeadC (talk | contribs) No edit summary |
PeaceDeadC (talk | contribs) No edit summary |
||
Line 1:
local p = {}
-- Load the configuration file
if not siteConfig then▼
-- Function to build a row of the table
function buildRow(site, id, alias, notes, index)
-- Determine the row color
local color
color = (index % 2 == 1) and cfg.colors.website1 or cfg.colors.website2
color = (index % 2 == 1) and cfg.colors.studio1 or cfg.colors.studio2
end
return siteConfig▼
-- Build the row
cfg.rowTemplate,
site == 'Website' and cfg.colors.websiteBg or cfg.colors.studioBg,
cfg.siteUrls[site][1],
cfg.siteUrls[site][2]:gsub('$1', id),
)
end
-- Main function
function p.main(frame)▼
-- Get the template parameters
-- Get the list parameter
local list = args.list or error('List not specified')
local rows = mw.text.split(list, '%s*' .. cfg.rowSeparator .. '%s*')
-- Build the table
local index = 1
local tableContent = ''
▲ alias = item.alias or mw.title.getCurrentTitle().text
for _, row in ipairs(rows) do
▲ notes = item.notes or 'N/A'
local params = mw.text.split(row, '%s*|%s*')
▲ else
if #params >= 3
local alias = params[3]
local notes = params[4] or ''
tableContent = tableContent .. buildRow(site, id, alias, notes, index)
end
▲ <td>%s</td>
▲ <td>%s</td>
▲ </tr>
end
▲ local tableHtml = string.format([[
-- Build the table
local tableHtml = string.format(cfg.tableTemplate, tableContent)
▲ %s
▲ </table>
return tableHtml
▲function p.main(frame)
▲ local args = frame:getParent().args
end
| |||