Module:ARG
Documentation for this module may be created at Module:ARG/doc
-- <nowiki>
local p = {}
local data = mw.loadData('Module:Navbox/Data')
local title = mw.title.getCurrentTitle()
local arg = "ARG"
function find_chapter(chapter)
for k1, v1 in ipairs(data) do
for k2, v2 in ipairs(v1) do
if title.text == v2 then
return k1, k2
end
end
end
return 0, 0
end
-- TODO: Get rid of code duplication
function p.prev_chapter(frame)
phase, chapter = find_chapter()
local name = data[phase][chapter - 1]
if name then
return '[[' .. arg .. ':' .. name .. '|' .. name .. ']]'
else
return 'N/A'
end
end
function p.next_chapter(frame)
phase, chapter = find_chapter()
local name = data[phase][chapter + 1]
if name then
return '[[' .. arg .. ':' .. name .. '|' .. name .. ']]'
else
return 'N/A'
end
end
function p.overview(frame)
phase, _ = find_chapter()
local text = arg .. ':Phase ' .. phase .. ' Overview'
return '[[File:Heart asset left.png|link=' .. text .. ']] [[' .. text .. '|Overview]]'
end
function p.summary(frame)
phase, _ = find_chapter()
local text = arg .. ':Phase ' .. phase .. ' Summary'
return '[[' .. text .. '|Summary]] [[File:Heart asset right.png|link=' .. text .. ']]'
end
return p