Modhul:Beaivvi govva

Dhokumèntasi modhul iki bisa digawé ing Modhul:Beaivvi govva/doc

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