equire("strict")
local yesNo = require("Module:Yesno")
local getArgs = require("Module:Arguments").getArgs
local p = {}
-- Determine whether we're being called from a sandbox (not really applicable here, but keeping the structure)
-- local sandbox = mw.getCurrentFrame():getTitle():find('sandbox', 1, true) and '/sandbox' or ''
-- Implements functionality to retrieve data from Module:Higher education task force/data
function p._main(args, data)
local dataModule = require('Module:Higher education task force/data')
local taskForceCode = args.code or args[1]
local taskForceData
if taskForceCode then
taskForceCode = taskForceCode:match('^%s*(.-)%s*$'):lower() -- trim whitespace and put in lower case
taskForceData = dataModule[taskForceCode]
end
-- No default needed here, as the module is for retrieving specific data
return taskForceData
end
--[[------------------------< getName >---------------------------------
Gets the full name of a task force.
]]----------------------------------------------------------------------------
function p.getName(frame)
local args = getArgs(frame, { parentFirst = true })
local tfData = p._main(args)
if tfData then
return tfData.name
end
return nil
end
--[[------------------------< getNestedName >---------------------------------
Gets the nested name of a task force.
]]----------------------------------------------------------------------------
function p.getNestedName(frame)
local args = getArgs(frame, { parentFirst = true })
local tfData = p._main(args)
if tfData then
return tfData.nested
end
return nil
end
--[[------------------------< getImage >---------------------------------
Gets the image filename for a task force.
]]----------------------------------------------------------------------------
function p.getImage(frame)
local args = getArgs(frame, { parentFirst = true })
local tfData = p._main(args)
if tfData then
return tfData.image
end
return nil
end
--[[------------------------< getCategory >---------------------------------
Gets the category name for a task force.
]]----------------------------------------------------------------------------
function p.getCategory(frame)
local args = getArgs(frame, { parentFirst = true })
local tfData = p._main(args)
if tfData then
return tfData.category
end
return nil
end
--[[------------------------< getLink >---------------------------------
Gets the project link for a task force.
]]----------------------------------------------------------------------------
function p.getLink(frame)
local args = getArgs(frame, { parentFirst = true })
local tfData = p._main(args)
if tfData then
return tfData.link
end
return nil
end
--[[------------------------< getCanonicalCode >---------------------------------
Gets the canonical code for a task force.
]]----------------------------------------------------------------------------
function p.getCanonicalCode(frame)
local args = getArgs(frame, { parentFirst = true })
local tfData = p._main(args)
if tfData then
return tfData.canonicalCode
end
return nil
end
function p.main(frame)
local args = getArgs(frame, { parentFirst = true })
return p._main(args)
end
p[''] = function (frame) return p._main(frame.args) end
return p