Modul:Qısayol

Vikipediya, azad ensiklopediya
Naviqasiyaya keçin Axtarışa keçin

Bu modulun sənədləşdirmə səhifəsi Modul:Qısayol/doc səhifəsində yaradıla bilər

local p = {}

function p.main (frame)
	local title = mw.ustring.gsub(mw.ustring.gsub(mw.text.trim(frame.args[1]),"%[%[",""),"%]%]","")
	local currentTitle = mw.title.getCurrentTitle().prefixedText
	if title ~= '' then
		local res
		local page = mw.title.makeTitle('', title)
		if not page or (page.prefixedText ~= currentTitle and (not page.redirectTarget or page.redirectTarget.prefixedText ~= currentTitle)) then
			res = '[[' .. title .. ']][[Kateqoriya:Qısayol şablonunu səhv istifadə edən səhifələr]]'
		else
			res = '<span class="ts-shortcut-visible">' .. title .. '</span><span style="display:none;" class="ts-shortcut-invisible">[[' .. title .. '|<span style="color:black;>' .. title .. '</span>]]</span>'
		end
		return res -- .. ' => ' .. page.redirectTarget.prefixedText .. ' vs. ' .. currentTitle
	end
end

return p