FANDOM


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.title .. "|" .. args.formattedtitle .. "]]'''" )
 
	if storyTitle ~= '' then
		mainDiv
			:wikitext( "<br>''\"" .. storyTitle .. "\"''" )
	end
 
	if inputMonth ~= '' and inputYear ~= '' then
		local formattedMonth = p.month( inputMonth )
		mainDiv
			:wikitext( "<br>([[:Category:" .. inputYear .. ", " .. formattedMonth .. "|" .. formattedMonth .. ", " .. inputYear .. "]])" )
	elseif inputYear ~= '' then
		mainDiv
			:wikitext( "<br>([[:Category:" .. inputYear .. "|" .. inputYear .. "]])" )
	elseif releaseDate ~= '' then
		local formmatedRD = frame:expandTemplate{ title = 'ReleaseDateConverter', args = { releaseDate, ',' } }
		mainDiv
			:wikitext( "<br><small>(''To be Released: " .. formmatedRD .. "'')</small>" )
	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.title .. "|" .. args.formattedtitle .. "]]'''" )
 
	if storyTitle ~= '' then
		mainDiv
			:wikitext( "<br>''\"" .. storyTitle .. "\"''" )
	end
 
	if inputSeason ~= '' and inputYear ~= '' then
		local formattedSeason = p.month( inputSeason )
		mainDiv
			:wikitext( "<br>([[:Category:" .. inputYear .. ", " .. formattedSeason .. "|" .. formattedSeason .. ", " .. inputYear .. "]])" )
	elseif inputMonth ~= '' and inputYear ~= '' then
		local formattedMonth = p.month( inputMonth )
		mainDiv
			:wikitext( "<br>([[:Category:" .. inputYear .. ", " .. formattedMonth .. "|" .. formattedMonth .. ", " .. inputYear .. "]])" )
	elseif inputYear ~= '' then
		mainDiv
			:wikitext( "<br>([[:Category:" .. inputYear .. "|" .. inputYear .. "]])" )
	elseif releaseDate ~= '' then
		local formmatedRD = frame:expandTemplate{ title = 'ReleaseDateConverter', args = { releaseDate, ',' } }
		mainDiv
			:wikitext( "<br><small>(''To be Released: " .. formmatedRD .. "'')</small>" )
	end
 
	return tostring( mainDiv )
end
 
return p
Community content is available under CC-BY-SA unless otherwise noted.

Fandom may earn an affiliate commission on sales made from links on this page.

Stream the best stories.

Fandom may earn an affiliate commission on sales made from links on this page.

Get Disney+