モジュール:サンドボックス/Q8j

これはこのページの過去の版です。Q8j (会話 | 投稿記録) による 2022年1月1日 (土) 12:47個人設定で未設定ならUTC)時点の版であり、現在の版とは大きく異なる場合があります。

local p = {}
function p.Main( frame )
	local b_a = ''
	local b_b = ''
	local b_c = ''
	local b_d = ''
	if frame.args['ns'] ~= '' then
		local pagename = frame.args['ns'] .. ':' .. frame.args[1]
		local pagetable = mw.title.new( pagename )
		local ns = pagetable.nsText
		local maintitle = tostring( pagetable.subjectPageTitle )
		b_a = '[[' ..  pagename .. ']]<span class="plainlinks" style="font-size:smaller">(' .. "'''[" .. tostring( mw.uri.fullUrl( pagename, 'redirect=no' ) ) .. " 非転送]''' / "
		if ns == 'ノート' then
			b_b = '[[' .. maintitle .. '|本文]]'
		elseif ns == '利用者' then
			b_b = '[[利用者‐会話:' .. frame.args[1] .. '|ノート]]'
		elseif ns == '利用者‐会話' then
			b_b = '[[' .. maintitle .. '|利用者ページ]]'
		elseif ns == 'Wikipedia‐ノート' then
			b_b = '[[' .. maintitle .. '|プロジェクトページ]]'
		elseif ns == 'ファイル‐ノート' then
			b_b = '[[' .. maintitle .. '|ファイル]]' --要検討
		elseif ns == 'Template‐ノート' then
			b_b = '[[' .. maintitle .. '|テンプレート]]'
		elseif ns == 'Help‐ノート' then
			b_b = '[[' .. maintitle .. '|ヘルプ]]'
		elseif ns == 'Category‐ノート' then
			b_b = '[[:' .. maintitle .. '|カテゴリ]]'
		elseif ns == 'Portal‐ノート' then
			b_b = '[[' .. maintitle .. '|ポータル]]'
		else
			b_b = '[[' .. frame.args['ns'] .. '‐ノート:' .. frame.args[1] .. '|ノート]]'
		end
		b_c = ' / [' .. tostring( mw.uri.fullUrl( pagename, 'action=history' ) ) .. ' 履歴] / [[特別:リンク元/' .. pagename .. '|リンク元]])</span>'
	else
		local ns = mw.title.new( frame.args[1] ).nsText
		local maintitle = tostring( mw.title.new( frame.args[1] ).subjectPageTitle )
		b_a = '[[:' .. frame.args[1] .. ']]<span class="plainlinks" style="font-size:smaller">' .. "('''[" .. tostring( mw.uri.fullUrl( frame.args[1], 'redirect=no' ) ) .. " 非転送]''' / "
		if ns == 'ノート' then
			b_b = '[[' .. maintitle .. '|本文]]'
		elseif ns == '利用者‐会話' then
			b_b = '[[' .. maintitle .. '|利用者ページ]]'
		elseif ns == 'Wikipedia‐ノート' then
			b_b = '[[' .. maintitle .. '|プロジェクトページ]]'
		elseif ns == 'ファイル‐ノート' then
			b_b = '[[' .. maintitle .. '|ファイル]]'--要検討
		elseif ns == 'Template‐ノート' then
			b_b = '[[' .. maintitle .. '|テンプレート]]'
		elseif ns == 'Help‐ノート' then
			b_b = '[[' .. maintitle .. '|ヘルプ]]'
		elseif ns == 'Category‐ノート' then
			b_b = '[[:' .. maintitle .. '|カテゴリ]]'
		elseif ns == 'Portal‐ノート' then
			b_b = '[[' .. maintitle .. '|ポータル]]'
		else
			b_b = '[[' .. tostring( mw.title.new( frame.args[1] ).talkPageTitle ) .. '|ノート]]'
		end
		b_c = ' / [' .. tostring( mw.uri.fullUrl( frame.args[1], 'action=history' ) ) .. ' 履歴] / [[特別:リンク元/' .. frame.args[1] .. '|リンク元]])</span>'
	end
	if frame.args[2] ~= '' then
		b_d = '→ [[:' .. frame.args[2] .. ']]<span class="plainlinks" style="font-size:smaller">([' .. tostring( mw.uri.fullUrl( frame.args[2], 'action=history' ) ) .. ' 履歴])</span>'
	elseif tostring( mw.title.getCurrentTitle() ) == 'Wikipedia:リダイレクトの削除依頼/受付' then
		b_d = "<span style='color:red'>エラー</span>:転送先を指定してください"
	end
	return '__NOINDEX__' .. '<span id="RFD' .. frame.args[1] .. '"></span>' .. b_a .. b_b .. b_c .. b_d
end
function p.Test( frame )
	return tostring(mw.title.getCurrentTitle())
end
return p