Module:Loops/Draft

--[[

PLEASE DON'T CHANGE ANYTHING HERE WITHOUT KNOWING WHAT YOU ARE DOING AND FIRST DISCUSSING IT.

THIS CODE IS USED BY MULTIPLE OTHER MODULES AND TEMPLATES.

THANKS <3

]]

local p = {}

function p.generatePageLinkList( frame ) --Get parameters passed into the calling template local templateArgs = frame:getParent.args local concatTable = {} --{{{namespace|{{{n|{{{ns|{{{1 --Limit to 100 because we need to treat the nice wiki well and not lag it :)	local i = frame.args[1] and 2 or 1	while i < 101 do		if templateArgs[i] then			table.insert( concatTable, "*" .. frame.args[1] .. ":" .. templateArgs[i]				.. " \n" )		else			mw.text.trim(concatTable[#concatTable])			break		end		i = i+1	end	return table.concat(concatTable) end

function p.characterStatusString(frame, args) local common = require( "Module:Common/Draft" ) local margin = ' ' local hr = '' local death = frame:expandTemplate{ title="Status", args={ "D" } } --local activeCharacters = {} --local inactiveCharacters = {} --local deceasedCharacters = {} --local unknownCharacters = {} local html = { ['Active'] = mw.html.create( 'div' ), ['Inactive'] = mw.html.create( 'div' ), ['Deceased'] = mw.html.create( 'div' ), ['Other'] = mw.html.create( 'div' ) }	local active = false local inactive = false local deceased = false local other = false local i = frame:getParent.args["player"] and 1 or 2 function enableHtml( s ) options = { ["Active"] = function if not active then active = true end end, ["Inactive"] = function if not inactive then inactive = true end end, ["Deceased"] = function if not deceased then deceased = true end end, ["Unknown"] = function if not other then other = true end end }		options[s] end while frame:getParent.args[i] do		local c = mw.text.trim( frame:getParent.args[i] ) local s = common.getCharacterStatus( c ) enableHtml(s) html[s] :wikitext(				' '.. 				tostring(mw.html.create( 'span' )					:css( {						['font-size'] = '0.8em',						['color'] = args["body_font_color"]					} )					:wikitext( c )				)..  ..				( ( s == "Deceased" ) and death or  ) ..				' '			) :tag( 'span' ) :css( {					['font-size'] = '0.8em',					['color'] = args["separator_color"]				} ) :wikitext( i > #frame:getParent.args and '•' or '' ) --end --• ' --table.insert(( s == "Active" and activeCharacters or ( s == "Inactive" and inactiveCharacters or (s == "Unknown" and unknownCharacters) ) ), ( ' ' .. c .. ' ' .. ' • ' )) --elseif s == "Deceased" then --	table.insert( deceasedCharacters, ' ' .. c .. ' ' .. death .. ' • ' ) --else --	error( "The character page for " .. c .. " either doesn't exist, or doesn't have the `Infobox Character` template implemented" ) --end i = i+1 end --if local outerMargin = 'margin', '10px 50px 10px 50px' function innerDivCss( stat ) return 'color: ' .. args[mw.ustring.lower( stat ) .. "_font_color"] .. ';' ..			'font-size: 1.0em' .. 'margin-bottom: 5px' end local outputVars = { ['Active'] = nil, ['Inactive'] = nil, ['Deceased'] = nil, ['Other'] = nil }	function generateStatusHtml( name ) --local outputHtml = {			['Active'] = function 				return outputVars[mw.ustring.lower( name )], htmlActive			end,			['Inactive'] = function 				return outputVars[mw.ustring.lower( name )], htmlInactive			end,			['Deceased'] = function 				return outputVars[mw.ustring.lower( name )], htmlDeceased			end,			['Other'] = function 				return outputVars[mw.ustring.lower( name )], htmlOther			end		} outputVars[name] = mw.html.create( 'div' ) :cssText( outerMargin ) if args["tabbed"] ~= true then outputVars[name] :tag( 'div' ) :cssText( innerDivCss( name ) ) :tag( 'b' ) :wikitext( name .. ' Characters' ) :done :tag( 'br' ) end outputVars[name] :node( html[name] ) --Need to factor in hr	end if active then generateStatusHtml( "Active" ) end if inactive then generateStatusHtml( "Inactive" ) end if deceased then generateStatusHtml( "Deceased" ) end if other then generateStatusHtml( "Other" ) end --local activeOutput = ( if args["tabbed"] == 'true' then local parserArgs = { } if active then outputVars["Active"] = ( ( outputVars["Active"] ~= "" ) and "Active=" .. tostring(outputVars["Active"]) ..				( ( outputVars["Other"] ~= "" or outputVars["Deceased"] ~= "" or outputVars["Inactive"] ~= "" ) and '|-|' or  ) or ) outputVars["Inactive"] = ( ( outputVars["Inactive"] ~= "" ) and "Inactive=" .. tostring(outputVars["Inactive"]) ..				( ( outputVars["Other"] ~= "" or outputVars["Deceased"] ~= "" ) and '|-|' or  ) or  ) outputVars["Deceased"] = ( ( outputVars["Deceased"] ~= "" ) and "Deceased=" .. tostring(outputVars["Deceased"]) ..				( ( outputVars["Other"] ~= "" ) and '|-|' or  ) or ) outputVars["Other"] = ( ( outputVars["Other"] ~= "" ) and "Other=" .. tostring(outputVars["Other"]) or '' ) end if activeOutput then table.insert(parserArgs, outputVars["Active"]) end if inactiveOutput then table.insert(parserArgs, outputVars["Inactive"]) end if deceasedOutput then table.insert(parserArgs, outputVars["Deceased"]) end if otherOutput then table.insert(parserArgs, outputVars["Other"]) end return frame:callParserFunction{ name="#tag:tabber", args={ table.concat(parserArgs) }} else return ' ' .. outputVars["Active"] .. outputVars["Inactive"] .. outputVars["Deceased"] .. outputVars["Other"] .. ' '	end end

function p.TEST( frame ) return mw.html.create( 'tabber' ) :wikitext(			'Active= TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST\n' ..			'|-|\n' ..			'Inactive=\nTEST TEST TEST TEST TEST TEST TEST TEST TEST TEST\n' ..			'|-|\n' ..			'Deceased=\nTEST TEST TEST TEST TEST TEST TEST TEST TEST TEST\n' ..			'|-|\n' ..			'Other= \nTEST TEST TEST TEST TEST TEST TEST TEST TEST TEST'		) end

return p