پودمان:Tfd links

نسخهٔ تاریخ ‏۲۴ ژانویهٔ ۲۰۲۵، ساعت ۱۹:۳۲ توسط محمد (بحث | مشارکت‌ها) (صفحه‌ای تازه حاوی «-- This module implements Template:Tfd links local p = {} local function urlencode(text) -- Return equivalent of {{urlencode:text}}. local function byte(char) return mw.ustring.format('%%%02X', mw.ustring.byte(char)) end return mw.ustring.gsub(mw.ustring.gsub(text, '[^ %w%-._]', byte), ' ', '+') end local function fullurllink(t, a, s) return '[https://fa.wikipedia.org/w/index.php?title=' .. urlencode(t) .. '&' .. a .. ' '...» ایجاد کرد)
(تفاوت) → نسخهٔ قدیمی‌تر | نمایش نسخهٔ فعلی (تفاوت) | نسخهٔ جدیدتر ← (تفاوت)

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

-- This module implements [[Template:Tfd links]]
local p = {}

local function urlencode(text)
	-- Return equivalent of {{urlencode:text}}.
	local function byte(char)
		return mw.ustring.format('%%%02X', mw.ustring.byte(char))
	end
	return mw.ustring.gsub(mw.ustring.gsub(text, '[^ %w%-._]', byte), ' ', '+')
end

local function fullurllink(t, a, s)
	return '[https://fa.wikipedia.org/w/index.php?title=' .. urlencode(t) .. '&' .. a .. ' ' .. s .. ']'
end

function p.main(frame)
	local args = frame:getParent().args
	local ns = (((args['catfd'] and args['catfd'] ~= '') and 'رده') or
		(args['module'] and args['module'] ~= '') and 'پودمان')
		or  'الگو'
	local tname = mw.getContentLanguage():ucfirst(args['1'])
	local fname = ns .. ':' .. tname
	local fullpagename = frame:preprocess('{{FULLPAGENAME}}')
	local sep = '&nbsp;<b>·</b> '
	
	local res = '<span id="' .. ns .. ':' .. tname 
	.. '" class="plainlinks nourlexpansion 1x">'
	.. '[[:' .. ns .. ':' .. tname .. ']]&nbsp;('
	.. '[[بحث ' .. ns .. ':' .. tname .. '|بحث]]' .. sep
	.. '[[ویژه:تاریخچه صفحه/' .. fname .. '|تاریخچه]]' .. sep
	.. fullurllink('ویژه:پیوند_به_این_صفحه/' .. fname, 'limit=5000&hidelinks=1', 'تراگنجانش‌ها')
	.. ' <sup>([https://linkcount.toolforge.org/?project=fa.wikipedia.org&page=' .. urlencode(ns .. tname) .. ' شمار])</sup>' .. sep
	.. fullurllink('ویژه:سیاهه‌ها', 'page=' .. urlencode(fname), 'سیاهه‌ها') .. sep
	.. '[[ویژه:نمایه_پیشوندی/' .. fname .. '/|زیرصفحه‌ها]])</span>'
	
	return res
end

return p