Documentation for this module may be created at Module:StaffCorrection/doc
local data = mw.loadData('Module:StaffCorrection/data')
----------------------------
-- Libraries of functions --
----------------------------
-- stands for High Frequency
-- local HF = require('Module:ComicsHF')
-- Parses invocation parameters, trims whitespace, and removes blanks.
local getArgs = require('Dev:Arguments').getArgs
----------------------------------------------------------
-- Public functions (called from a Template or article) --
----------------------------------------------------------
local StaffCorrection = {}
function StaffCorrection.correction( frame )
local args = getArgs(frame)
-- Throws an error if there's a blank or absent parameter.
assert( type( args[1] ) == 'string', "Template:StaffCorrection has no value" )
return StaffCorrection:normalize( args[1] )
end
--------------------------------------------------------
-- Internal functions (used in this and other Modules --
--------------------------------------------------------
function StaffCorrection:normalize( name )
lowername = string.lower( name )
if type( data[lowername] ) == 'string' then
return data[lowername]
else
return name
end
end
function StaffCorrection:link( name )
return string.format('[['..'%s]]', self:normalize(name))
end
function StaffCorrection:cat_role( name, role )
category = self:normalize(name)..'/'..role
return string.format(
'[['..'Category:%s|%s]]',
category,
mw.getCurrentFrame():expandTemplate { title = "TheSort" }
)
end
function StaffCorrection:in_database( name )
if type( data[ string.lower( name ) ] ) == 'string' then
return true
else
return nil
end
end
-------------------------------------------------
-- Output (send it back to whatever called it) --
-------------------------------------------------
return StaffCorrection