Modul:Valgdistrikt

Fra Wikipedia, den frie encyklopædi
Documentation icon Moduldokumentation[opret]
local p = {}
 
function p.start(frame)
    local pFrame = frame:getParent();
    local args = pFrame.args;
    for k,v in pairs( frame.args ) do
        args[k] = v;
    end

    local text = ''
    local partiet = require('Modul:Partier dk')
 
    local i = 1
 
    while args[i] and args[i] ~= '' do
        local kort = args[i]
        frame.args = { kort }
        local vector = partiet.partisnack(frame) 
        if vector == nil then
             return 'ERROR'
        end
        local a = vector['a']
        local t = vector['t']
        local n = vector['n']
        local f = vector['f']
        local l = vector['l']
        local t4 = mw.text.tag('span', {style="color:" .. t .. ";"}, a)
        t4 = mw.text.tag('th', {style = "background:" .. f .. ";min-width:2.1em;max-width:2.3em;", title = n}, "[[" .. l .. "|" .. t4 .. "]]")
        text = text .. t4
        i = i + 1
    end
    i = i*2.1+60.5
 
    text = mw.text.tag('tr', {}, text)
    --text = mw.text.tag('table', {class="wikitable", border="1", style="text-align:center;font-size:88%;width:" .. i .. "em;"}, text)
    return text 
 
end

function p.n(frame)
    local pFrame = frame:getParent();
    local args = pFrame.args;
    local i = 1
    while args[i] ~= nil do
        i = i + 1
    end
    local h = 2.1 * i + 58.4
    return h .. ''
end
 
return p