Modul:IfExistsNotRedirect

Modul podobně jako parserová funkce #ifexist zjišťuje, jestli daná stránka existuje, s rozdílem, že přesměrování se počítají jako neexistující.

Použití editovat

{{#invoke:IfExistsNotRedirect|main|název stránky|co vrátit, když stránka existuje a není přesměrování|opačný případ (volitelný)}}
local p = {}

function p.main(frame)
	if not (frame and frame.args and frame.args[1] and frame.args[2]) then return nil end
	local title = mw.title.new(mw.text.trim(frame.args[1]))
	return (title.exists and not title.isRedirect and frame.args[2]) or frame.args[3] or nil
end

return p