Module:Cisnodpl

local p = {}

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

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

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.cis( frame ) local args = frame:getParent.args local inputMonth = p.trim( args.Month ) local inputYear = p.trim( args.Year ) local storyTitle = p.trim( args.StoryTitle1 ) local releaseDate = p.trim( args.ReleaseDate ) local mainDiv = mw.html.create( 'div' )

mainDiv :css( 'text-align', 'center' ) :wikitext( "" .. args.formattedtitle .. "" )

if storyTitle ~= '' then mainDiv :wikitext( " \"" .. storyTitle .. "\"" ) end

if inputMonth ~=  and inputYear ~=  then local formattedMonth = p.month( inputMonth ) mainDiv :wikitext( " (" .. formattedMonth .. ", " .. inputYear .. ")" ) elseif inputYear ~= '' then mainDiv :wikitext( " (" .. inputYear .. ")" ) elseif releaseDate ~= '' then local formmatedRD = frame:expandTemplate{ title = 'ReleaseDateConverter', args = { releaseDate, ',' } } mainDiv :wikitext( " (''To be Released: " .. formmatedRD .. "'') " )	end

return tostring( mainDiv ) end

function p.cid( frame ) local args = frame:getParent.args local inputSeason = p.trim( args.Season ) local inputMonth = p.trim( args.Month ) local inputYear = p.trim( args.Year ) local storyTitle = p.trim( args.StoryTitle1 ) local releaseDate = p.trim( args.ReleaseDate ) local mainDiv = mw.html.create( 'div' )

mainDiv :css( 'text-align', 'center' ) :wikitext( "" .. args.formattedtitle .. "" )

if storyTitle ~= '' then mainDiv :wikitext( " \"" .. storyTitle .. "\"" ) end

if inputSeason ~=  and inputYear ~=  then local formattedSeason = p.month( inputSeason ) mainDiv :wikitext( " (" .. formattedSeason .. ", " .. inputYear .. ")" ) elseif inputMonth ~=  and inputYear ~=  then local formattedMonth = p.month( inputMonth ) mainDiv :wikitext( " (" .. formattedMonth .. ", " .. inputYear .. ")" ) elseif inputYear ~= '' then mainDiv :wikitext( " (" .. inputYear .. ")" ) elseif releaseDate ~= '' then local formmatedRD = frame:expandTemplate{ title = 'ReleaseDateConverter', args = { releaseDate, ',' } } mainDiv :wikitext( " (''To be Released: " .. formmatedRD .. "'') " )	end

return tostring( mainDiv ) end

return p