پودمان:Link

از ویکی‌واژه

توضیحات این پودمان می‌تواند در پودمان:Link/توضیحات قرار گیرد.

local p = {}

function p.link(frame)
	local out = ''
	local target = frame.args[1]
	if target ~= nil then
		target = mw.ustring.lower(target)
		local link = frame.args[2]
		if link ~= nil then
			local title = frame.args[3]
			if title == nil then
				title = link
			end
			if target == 'پ' then
				target = 'w'
			elseif target == 'س' then
				target = 'voy'
			elseif target == 'خ' then
				target = 'n'
			elseif target == 'ن' then
				target = 's'
			elseif target == 'گ' then
				target = 'q'
			elseif target == 'ک' then
				target = 'b'
			elseif target == 'و' then
				target = 'wikt'
			end
			out = out .. '[[:' .. target .. ':' .. link .. '|' .. title .. ']]'
		end
	end
	return out
end

return p