Modül:Şablon tartışması bağlantıları

Vikipedi, özgür ansiklopedi
Modül belgelemesi[oluştur]
-- This module implements [[Template:Tfd links]]
local p = {}

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

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

function p.main(frame)
	local args = frame:getParent().args
	local ns = ((args['saşk'] and args['saşk'] ~= '') and 'Kategori')
		or ((args['modül'] and args['modül'] ~= '') and 'Modül') 
		or  'Şablon'
	local tname = mw.getContentLanguage():ucfirst(args['1'] or 'Örnek')
	local fname = ns .. ':' .. tname
	local ymd = args['2'] or ''
	local fullpagename = (ymd ~= '')
		and	'Vikipedi:Şablon tartışmaları/' .. ymd
		or frame:preprocess('{{FULLPAGENAME}}')
	local sep = '&nbsp;<b>·</b> '
	local newline = '<br />'
	
	local res = '<span id="' .. fname 
		.. '" class="plainlinks nourlexpansion 1x">'
		.. '[[:' .. fname .. ']]&nbsp;('
	
	if ymd ~= '' then
		local dmy = frame:expandTemplate{ title='date', args={ymd, 'dmy'} } 
		res = res .. '[[' .. fullpagename .. '#' .. fname 
			.. '|' .. dmy .. ']]) ('
	end
	res = res .. fullurllink(fname, 'action=edit', 'değiştir') .. sep
	res = res .. '[[' .. ns .. ' tartışma:' .. tname .. '|tartışma]]' .. sep
	res = res .. fullurllink(fname, 'action=history', 'geçmiş') .. sep
	if ns ~= 'Kategori' then
		res = res .. fullurllink('Special:Whatlinkshere/' 
			.. fname, 'limit=5000', 'bağlantılar') .. sep
		res = res .. fullurllink('Special:Whatlinkshere/' 
			.. fname, 'limit=5000&hidelinks=1', 'görüntülemeler') .. sep
	end
	res = res .. fullurllink('Special:Log', 'page=' 
		.. urlencode(fname), 'günlükler') .. sep
	res = res .. '[[Special:PrefixIndex/' .. fname .. '/|alt sayfalar]]'
	res = res .. '<span class="sysop-show">' .. sep .. fullurllink(fname, 'action=delete&wpReason=' 
		.. urlencode('[[' .. fullpagename .. ']]'), 'sil') .. '</span>'
	res = res .. ')</span>'
	if mw.title.new( 'Vikipedi:Şablon tartışmaları/' .. fname .. ' (2. aday gösterme)', '' ).exists == true then
		res = res .. ' - Adaylıklar ('
		res = res .. '[[Vikipedi:Şablon tartışmaları/' .. fname .. '|1]]' 
		res = res .. sep .. '[[Vikipedi:Şablon tartışmaları/' .. fname .. ' (2. aday gösterme)|2]]'
		if mw.title.new( 'Vikipedi:Şablon tartışmaları/' .. fname .. ' (3. aday gösterme)', '' ).exists == true then
			res = res .. sep .. '[[Vikipedi:Şablon tartışmaları/' .. fname .. ' (3. aday gösterme)|3]]'
		end
		if mw.title.new( 'Vikipedi:Silinmeye aday sayfalar/' .. fname .. '', '' ).exists == false then
			res = res .. ')'
		end
	end
	if mw.title.new( 'Vikipedi:Silinmeye aday sayfalar/' .. fname .. '', '' ).exists == true then
		if mw.title.new( 'Vikipedi:Şablon tartışmaları/' .. fname .. ' (2. aday gösterme)', '' ).exists == true then
			res = res .. sep
		else
			res = res .. ' - Adaylıklar ('
		end
		if mw.title.new( 'Vikipedi:Silinmeye aday sayfalar/' .. fname .. ' (2. aday gösterme)', '' ).exists == true then
			res = res .. '[[Vikipedi:Silinmeye aday sayfalar/' .. fname .. '|SAS 1]]'
			res = res .. sep .. '[[Vikipedi:Silinmeye aday sayfalar/' .. fname .. ' (2. aday gösterme)|SAS 2]]'
			res = res .. ')'
		else
			res = res .. '[[Vikipedi:Silinmeye aday sayfalar/' .. fname .. '|SAS]]'
			res = res .. ')'
		end
		if mw.title.new( 'Vikipedi:Şablon tartışmaları/' .. fname .. ' (2. aday gösterme)', '' ).exists == false then
			res = res .. ')'
		end
	end
	
	return res
end

return p