Module:Release status

From Commons Wiki
Jump to navigation Jump to search
-- <nowiki>
local p = {}

local wdsButton = require('Dev:WDS Button')
local data = mw.loadData('Dev:Release status/data')
local i18n = require('Dev:I18n').loadMessages('Release status', 'Common')
local title = mw.title.getCurrentTitle()

function p.status(frame)
    local tmp = mw.ustring.lower(frame:getParent().args[1] or '')
    -- local status = data[tmp] and tmp or status
    local status = tmp
    if not status or status == '' then
        status = 'broken'
    end
    local html = wdsButton._badge(i18n:msg(status), status)
    local cat = data[status]
    if cat and title.namespace == 0 then
        html = '[[:Category:' .. cat .. '|' .. html .. ']][[Category:' .. cat .. ']]'
    end
    return html
end

return p