Jump to content

Module:Metrics dashboard

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Harej (talk | contribs) at 17:32, 10 May 2023. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

local p = {}

local function listItem(value, label)
    return string.format('* <span class="md-value">%s</span><span class="md-label">%s</span>', value, label)
end

function p.list(frame)
    local output = ''
    local i = 1
    local args = frame:getParent().args

    while args['figure' .. i .. '-value'] and args['figure' .. i .. '-label'] do
        local value = args['figure' .. i .. '-value']
        local label = args['figure' .. i .. '-label']

        output = output .. listItem(value, label) .. '\n'

        i = i + 1
    end

    -- Check if 'footer' parameter is provided
    if args['footer'] then
        output = output .. '<div style="text-align:center; font-size:smaller; padding-top:1.5em; padding-bottom:1.5em;">' .. args['footer'] .. '</div>'
    end

    return output
end

return p