[go: up one dir, main page]

Modul:WpPreload

local p = {}

function p.napraviWp(frame, wp, tekst, tipskiClanak, args, summary)
	local naslov = mw.title.new(wp , 0 ) -- naslov i NS
	
	if naslov.exists then 
		return "[[" .. wp .. "|" .. tekst .."]]"
	else
		return p.crvenaWp(frame, wp, tekst, tipskiClanak, args, summary)
	end
end

function p.crvenaWp(frame, wp, tekst, tipskiClanak, args, summary)
	local html = '<span class="plainlinks">['
		.. '{{fullurl:'.. mw.uri.anchorEncode(wp)
		.. '|action=edit'
		.. '&preload=Wikipedija:' .. tipskiClanak
		
		for i, v in ipairs(args) do
			html = html .. '&preloadparams%5b%5d='.. v
		end
		
		html = html .. '&summary=' .. mw.uri.encode(summary) ..'}}<span style="color:#ba0000;">'.. tekst .. '</span>]</span>'
		
	return frame:preprocess(html)
end
return p