モジュール:サブページ過去ログ
表示
モジュールの解説[作成]
local p = {}
function p.Main( frame )
local m_pagetitle = mw.site.namespaces[mw.title.getCurrentTitle().namespace].name .. ':' .. mw.title.getCurrentTitle().baseText
local m_archivetitle = ''
if frame.args['title'] == '' then
m_archivetitle = '過去ログ' .. frame.args[1]
else
m_archivetitle = frame.args['title']
end
local m_fulltitle = m_pagetitle .. '/' .. m_archivetitle
function sectionlink( f_topic , f_link)
if f_link ~= nil then
return '[[' .. m_fulltitle .. '#' .. f_link .. '|' .. f_topic .. ']]'
else
return '[[' .. m_fulltitle .. '#' .. f_topic .. '|' .. f_topic .. ']]'
end
end
local m_NavTitle = ''
if frame.args['summary'] == '' then
if frame.args[2] == '' then
m_NavTitle = frame.args[1]
else
m_NavTitle = frame.args[2]
end
else
m_NavTitle = frame.args['summary']
end
local m_i = 1
local m_body = '<div class="NavFrame" style="margin: 3px">\n'
.. '<div class="NavHead">[[' .. m_fulltitle .. '|' .. m_archivetitle .. ']]</div>\n'
.. '<div class="NavTitle">' .. m_NavTitle .. '</div>\n'
.. '<div class="NavContent" style="text-align: left">'
while ( mw.getCurrentFrame():getParent().args['topic' .. m_i] ~= nil and m_i <= 200 ) do
m_body = m_body .. '\n# ' .. sectionlink( mw.getCurrentFrame():getParent().args['topic' .. m_i] , mw.getCurrentFrame():getParent().args['link' .. m_i] )
m_i = m_i + 1
end
m_body = m_body .. '\n</div></div>'
return m_body
end
return p