Moduuli:läh-kale

Wikisanakirjasta

Tämän moduulin ohjeistuksen voi tehdä sivulle Moduuli:läh-kale/ohje

local linkinalku = "http://www.finlit.fi/kalevala/index.php?s="
local linkinloppu = ""
local data = {
    [1] = "2", 
    [2] = "5", 
    [3] = "12", 
    [4] = "70", 
    [5] = "69", 
    [6] = "68", 
    [7] = "67", 
    [8] = "66", 
    [9] = "65", 
    [10] = "64", 
    [11] = "63", 
    [12] = "62", 
    [13] = "61", 
    [14] = "60", 
    [15] = "59", 
    [16] = "58", 
    [17] = "57", 
    [18] = "56", 
    [19] = "55", 
    [20] = "54", 
    [21] = "53", 
    [22] = "52", 
    [23] = "51", 
    [24] = "50", 
    [25] = "49", 
    [26] = "37", 
    [27] = "36", 
    [28] = "35", 
    [29] = "34", 
    [30] = "33", 
    [31] = "32", 
    [32] = "31", 
    [33] = "30", 
    [34] = "29", 
    [35] = "28", 
    [36] = "27", 
    [37] = "26", 
    [38] = "25", 
    [39] = "24", 
    [40] = "23", 
    [41] = "22", 
    [42] = "21", 
    [43] = "20", 
    [44] = "19", 
    [45] = "18", 
    [46] = "17", 
    [47] = "16", 
    [48] = "15", 
    [49] = "14", 
    [50] = "13", 
}

function muotoile(runo, sakeet)
    sakeettxt = ""
    if sakeet then
        sakeettxt = ", v. " .. sakeet
    end
    if not runo then runo = "??" end
    nro = data[tonumber(runo)]
    if not nro then nro = "??" end
	
    return "Kalevala. 1849. E. Lönnrot. Helsinki: Suomalaisen kirjallisuuden seura: " .. runo .. ". runo" .. sakeettxt .. "."
end

local m = {}
function m.Muotoile(frame)
    local pframe = frame:getParent()
    return muotoile(pframe.args[1], pframe.args[2])
end

--testi
--print(m.Muotoile{ ['getParent'] = function() return { ['args'] = { [1] = 40 } } end })

return m