Przejdź do zawartości

Moduł:Proofnr

Z Wikiźródeł, wolnej biblioteki

Dokumentacja dla tego modułu może zostać utworzona pod nazwą Moduł:Proofnr/opis

function ycount( frame )
	local args = frame.args
	local result = 0
	local year = os.date('%Y')
	local pageproof = 'Ukończone_projekty_proofread'
	if tonumber(args['rok']) ~= nil then
		year = args['rok']
	elseif tonumber(args[1]) ~= nil then
		year = args[1]
	end
	if tonumber(year) < tonumber(os.date('%Y')) and tonumber(year) > 2008 then
		pageproof = pageproof .. '/' .. year
	end

	local pagepr =  mw.title.makeTitle( 'Wikiźródła', pageproof )
	local code = pagepr:getContent()
--	mw.log(code)

	local indeks = {}
	for index in string.gmatch( code, '\|[iI]ndeks ?\=.-\n' ) do
		indeks[index] = "ok"
	end
	for k,v in pairs(indeks) do
		result=result+1
	end

	return result
end

local p = {}
function p.proofy( frame )
    return ycount( frame:getParent() ) 
end
return p