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

モジュールの解説[作成]
local p = {}

function p.Main(frame)
	local m_argtitle = mw.uri.decode(frame.args[1],'WIKI')
	local m_title = mw.title.new(m_argtitle)
	local m_spanid = '<span id="{{モジュール‐ノート:サンドボックス/Q8j/Template:Page|' .. m_argtitle .. '}}"></span><span id ="' .. m_argtitle .. '"></span>'
	local m_talklink = '[[' .. mw.allToString(m_title.talkPageTitle) .. '|ノート]]'
	local m_historylink = '[//ja.wikipedia.org/w/index.php?title=' .. mw.uri.encode(m_argtitle,"WIKI") .. '&action=history 履歴]'
	local m_loglink = '[//ja.wikipedia.org/w/index.php?title=%E7%89%B9%E5%88%A5:Log&page=' .. mw.uri.encode(m_argtitle,"WIKI") .. ' ログ]'
	local m_whatlinkshere = '[[Special:WhatLinksHere/' .. m_argtitle .. '|リンク元]]'

	local m_pagelink = ''
	if m_title.isRedirect then
		m_pagelink = '<span class="plainlinks">[//ja.wikipedia.org/w/index.php?title=' .. mw.uri.encode(m_argtitle,"WIKI") .. '&redirect=no ' .. m_argtitle .. ']</span>'
	else
		m_pagelink = '[[' .. m_argtitle .. ']]'
	end

	if m_title.isTalkPage then
		return m_spanid .. m_pagelink .. '<span style="font-size:smaller" class="plainlinks">(' .. m_historylink .. ' / ' .. m_loglink .. ' / ' .. m_whatlinkshere .. ')</span>'
	else
		return m_spanid .. m_pagelink .. '<span style="font-size:smaller" class="plainlinks">(' .. m_talklink .. ' / ' .. m_historylink .. ' / ' .. m_loglink .. ' / ' .. m_whatlinkshere .. ')</span>'
	end

end

return p