Przejdź do zawartości

Moduł:Indeks

Z Wikiźródeł, wolnej biblioteki

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

function istan( frame )
	local args = frame.args
	local pagetitle = frame:getTitle()

	local paget =  mw.title.makeTitle( '', pagetitle )
	local code = paget:getContent()
	local indeks = string.match( code, '\| *[Ss]trona indeksu *\= *([^\|\}]-)[\n\|\}]' )
	if indeks == nil then
		return 0
	end
	local ipaget =  mw.title.makeTitle( 'Indeks', indeks )
	local icode = ipaget:getContent()	
	local postep = string.match( icode, '\| *[Pp]ostęp *\= *([^\|\}]-)[\n\|\}]' )
	if postep == nil then
		return 0
	end
--	mw.log(postep)	
	return postep
end

function istan_dt( frame )
	local args = frame.args
	local indeks = args['strona indeksu']
	if indeks == nil or indeks =='' then
		return 0
	end
	local ipaget =  mw.title.makeTitle( 'Indeks', indeks )
	local icode = ipaget:getContent()	
	local postep = string.match( icode, '\| *[Pp]ostęp *\= *([^\|\}]-)[\n\|\}]' )
	if postep == nil then
		return 0
	end
--	mw.log(postep)	
	return postep
end


local p = {}
function p.stan( frame )
    return istan( frame:getParent() ) 
end
function p.stan_dt( frame )
    return istan_dt( frame:getParent() ) 
end

return p