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 21:06, 27 April 2023 (Lua module to create a list of values and labels, stylized with CSS in a separate step). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

local p = {}

local function listItem(value, label)
    return string.format('* %s %s', value, label)
end

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

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

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

        i = i + 1
    end

    return output
end

return p