Arrowverse Wiki
Advertisement
Arrowverse Wiki
Module documentation

This module has various functions described below and should only be utilized on templates. To call a module in a template, insert {{#invoke:RecentRelease|function name|various parameters}} onto the template.[ Data ]

For help on this module, please contact an administrator.
Visit Module:RecentRelease/doc to edit this text! (How does this work?)

--[[Category:Lua modules]]
local p = {}
local releaseData = mw.loadData('Module:RecentRelease/data')

function removeParen(fullTitle)
    local title={}
    local length= mw.ustring.len(fullTitle)
    local par={}
    if mw.ustring.find(fullTitle,'(',1,true)==nil
        then par=length
        else par=mw.ustring.find(fullTitle,'(',1,true)-2
    end
    local title=mw.ustring.sub(fullTitle,1,par)
    return title
end
function p.getInfo(frame)
    local obtaining= frame.args[1]
    local show= frame.args[2]
    if show=="The Flash (The CW)"
        then show="The Flash"
    end
    local result={}
    if releaseData[show]
        then if obtaining=="last"
            then result="{{Ep"
              .."|"
              ..releaseData[show][1]
              .."}}"
            else if obtaining=="next"
                then if releaseData[show][3]=="season"
                    then result="[[Season "
                        ..releaseData[show][6]
                        .." ("
                        ..show
                        ..")|Season "
                        ..releaseData[show][6]
                        .."]]"
                    else result="{{Ep"
                        .."|"
                        ..releaseData[show][3]
                        .."}}"
                    end
                else if obtaining=="date"
                    then result=releaseData[show][4]
                    end
                end
            end
        else result="[["
            .."Category:Broken S link|"
            ..show
            .."]]"
    end
    return frame:preprocess(result)
end

function p.MPinfo(frame)
    local obtaining= frame.args[1]
    local show= frame.args[2]
    if show=="The Flash (The CW)"
        then show="The Flash"
    end
    local result={}
    if releaseData[show]
        then if obtaining=="last"
            then result="[["
                        ..releaseData[show][1]
                        .."|<small><small>"
                        ..removeParen(releaseData[show][1])
                        .."</small></small>]]"
            else if obtaining=="next"
                then if releaseData[show][3]=="season"
                    then result="[[Season "
                        ..releaseData[show][6]
                        .." ("
                        ..show
                        ..")|<small><small>Season "
                        ..releaseData[show][6]
                        .."</small></small>]]"
                    else result="[["
                            ..releaseData[show][3]
                            .."|<small><small>"
                            ..removeParen(releaseData[show][3])
                            .."</small></small>]]"
                    end
                else if obtaining=="date"
                    then result=releaseData[show][4]
                    end
                end
            end
        else result="[["
            .."Category:Broken S link|"
            ..show
            .."]]"
    end 
    return frame:preprocess(result)
end

function p.current(frame)
	local show= frame.args[1]
    if show=="The Flash (The CW)"
        then show="The Flash"
    end
    if show=="DC&#39;s Legends of Tomorrow"
    	then show="DC's Legends of Tomorrow"
    end
    local status1="?"
    local season="?"
    local status2="?"
    if releaseData[show]
    	then season=releaseData[show][6]
    		status1="upcoming"
    		status2="episode"
    		if releaseData[show][5]==releaseData[show][6]
    			then status1="current"
    		end
    		if releaseData[show][3]=="season"
    			then status1="most recent"
    				 status2="season"
    				 season=releaseData[show][5]
    		end
    end
	local displayText="''For the "
		..status1
		.." season of "
		..show
		..", see [[Season "
		..season
		.." ("
		..show
		..")|Season "
		..season
		.."]].''<br/>''For the upcoming "
		..status2
		.." of "
		..show
		..", see {{Upcoming|next|"
		..show
		.."}}.''"
	return frame:preprocess(displayText)
end

function p.cc(frame)
	local show=frame.args[1]
	local ap="airs"
	if releaseData[removeParen(show)]
		then if releaseData[removeParen(show)][3]=="season"
				then ap="premieres"
		end
	end
	local CS="ColorSwitch"
	if show=="Black Lightning"
		then CS="ColorSwitch1"
		else if show=="Superman & Lois"
			then CS="ColorSwitch1"
			end
	end
	local displayText="*<small>'''{{S|"
		..show
		.."|#{{"
		..CS
		.."|series="
		..show
		.."}}}}:''' {{Upcoming|next|"
		..show
		.."}} "
		..ap
		.." {{Upcoming|date|"
		..show
		.."}}!</small>"
	return frame:preprocess(displayText)
end

return p
Advertisement