Modul:Dodaj infookvir

Izvor: Wikipedija


local p = {}

function p.main(frame)
	local template = mw.getCurrentFrame():getParent().args[1]
	template = frame:preprocess('{{lcfirst:'..template..'}}');
    template = template:gsub( "infookvir ", "")
	local nazivKategorije = mw.title.new('Nedostaje infookvir ' .. template, 14 ) -- NS Kategorija
	
	local wikiCode = '{| class="box-Dodaj_infookvir infobox" style="width: 20em; font-size: 95%; text-align: center; border: 1px solid #aaa; 1px;" cellpadding="3"' ..
	'\n|- style="background-color: #CCCCCC;"' ..
	'\n| Dodaj infookvir "[[predložak:infookvir ' .. template .. '|' .. template ..']]".<br /><small>([[Posebno:Whatlinkshere/Predložak:' .. template ..'|Primjeri uporabe predloška]])</small>'..
	'\n|}' ..
	'\n'
	
	local title = mw.title.getCurrentTitle().text
	
	if nazivKategorije.exists then
		wikiCode = wikiCode .. '[[Kategorija:Nedostaje infookvir ' .. template .. '|' .. title .. ']]'
	else
		wikiCode = wikiCode .. '[[Kategorija:Nedostaje infookvir|' .. template .. title .. ']]'
	end
		
	return wikiCode
end
return p