Module:Eras

-- This module implements Template:Eras.

local DATA_MODULE = 'Module:Eras/data'

--- -- Eras class ---

local Eras = {} Eras.__index = Eras

function Eras.new(args) local obj = setmetatable({}, Eras) local data = mw.loadData(DATA_MODULE)

-- Set the object structure. obj.categories = {}

-- Get the icon data. do local iconConfig = data.icons local icons = {} for _, v in ipairs(args) do			local t = iconConfig[v] if t then icons[v] = t			else obj:setBadParameterFlag end end obj.icons = icons end

return obj end

function Eras:setBadParameterFlag self.hasBadParameter = true end

--- -- Exports ---

local p = {}

function p._main(args) local erasObj = Eras.new(args) return tostring(erasObj) end

function p.main(frame) local args = {} for k, v in pairs(args) do		v = v:match('^%s*(.-)%s*$') -- trim whitespace if v ~= '' then args[k] = v		end end return p._main(args) end

return p