Modula:Beaivvi govva
Olggosoaidnin
Dokumentasjon for denne modulen kan opprettes på Modula:Beaivvi govva/veahkki
local p = {}
local govvalistu = require("Module:Beaivvi govva/listu")
local govat_ja_govvadusat = {}
for _,govva in ipairs(govvalistu) do
if govva[2] then
table.insert(govat_ja_govvadusat, govva)
end
end
function beaivvi_govva()
odne = os.date("%Y%m%d")
govva = (odne % #govat_ja_govvadusat) + 1
return govat_ja_govvadusat[govva]
end
function p.govvanamma(frame)
return beaivvi_govva()[1]
end
function p.govvateaksta(frame)
return beaivvi_govva()[2]
end
function p.buot_govat(frame)
local maddu = mw.html.create('table')
maddu
:addClass("wikitable")
:addClass("sortable")
:css("width", "100%")
:tag('tr')
:tag('th')
:css("width", "250px")
:wikitext("Govva")
:tag('th')
:css("width", "15vw")
:wikitext("Govva čoazahusain")
:tag('th')
:wikitext("Govvateaksta")
for _,govva in ipairs(govvalistu) do
local emptyclass = nil
local desc = false
if not govva[2] then
emptyclass = "empty"
desc = "Ii leat govvateaksta"
else
desc = govva[2]
end
local gurgadus = mw.html.create("tr")
maddu
:tag('tr')
:tag('td')
:wikitext("[[" .. govva[1] .. "|250px]]")
:tag('td')
:addClass("govva")
:wikitext("[[" .. govva[1] .. "|400px]]")
:tag('td')
:addClass("govvateaksta")
:addClass(emptyclass)
:wikitext(desc)
end
return tostring(maddu)
end
return p