Module:Alert list

local p = {} local standardIcons = require('Module:Standard icons') local iconTable = standardIcons.getIconTable

local labelTable = { ["frequent-domain"] = "Frequent domain", ["prohibited-domain"] = "Prohibited domain appears in article", ["new-domain"] = "Unrecognized domain", ["flagged-domain"] = "Flagged domain", alert = "Alert", discuss = "New talk page thread", info = "Information", }

local function renderNotification(args, index) local typeKey = args['type' .. index] local icon = args['icon' .. index] or iconTable[typeKey] local label = args['label' .. index] or labelTable[typeKey] local msg = args['msg' .. index] local action = args['action' .. index] local time = args['time' .. index]

if not icon or not label then return '' end

local notification = { '* " .. label .. " ",    }

if msg and msg ~= '' then table.insert(notification, '*: ' .. msg) end

if action and action ~= '' then table.insert(notification, '*: ' .. action) end if time and time ~= '' then table.insert(notification, '*: ' .. time .. ' ') end

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

function p.main(frame) local args = frame:getParent.args local output = {}

local maxIndex = 0

for key, _ in pairs(args) do       local index = tonumber(key:match("(%d+)$")) if index and index > maxIndex then maxIndex = index end end

for index = 1, maxIndex do       local notification = renderNotification(args, index) if notification ~= '' then table.insert(output, notification) end end

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

return p