Module:Month

local p = {}

local monthData = mw.loadData( 'Module:Month/data' ) local monthAliases = monthData[1] local monthNumbers = monthData[2]

function p.trim( s, charset ) if s == nil then return '' end charset = charset or '\t\r\n\f ' s = mw.ustring.gsub( s, '^[' .. charset .. ']*(.-)[' .. charset .. ']*$', '%1' ) return s end

function p.month( frame ) local month = p.trim( frame.args[1] ) local monthAlias = monthAliases[string.lower( month )] if monthAlias ~= nil then return monthAlias end return month end

function p._month( item ) local month = p.trim( item ) local monthAlias = monthAliases[string.lower( month )] if monthAlias ~= nil then return monthAlias end return month end

function p.monthNo( frame ) local month = p.trim( frame.args[1] ) local monthNumber = monthNumbers[string.lower( month )] if monthNumber ~= nil then return monthNumber end return month end

return p