Marvel Database
Marvel Database

Documentation for this module may be created at Module:Team Template/doc

-- module for Marvel Database:Team Template
local p = {}
local getArgs = require('Module:Arguments').getArgs 
local h = require("Module:HF")
local design = require('Module:Design')

function p.main(frame)
	local args = getArgs(frame)
	local pagename = mw.title.getCurrentTitle().text
	local page_type = 'Team'
	local value
	local categories = {}
	local output_categories = {}
	local output = {}

	table.insert(output_categories, p.lua_get_outdated_fields(args) )

-- sections
	-- adds 'Quote', 'Overview' section, 'TOC' and 'History' section
	value, categories = design.add_quote_overview_toc_history(args, page_type)
	output_categories = h.join_tables(output_categories, categories)
	output = h.join_tables(output, value)

	if not h.isempty(args.Equipment) or not h.isempty(args.Weapons)or not h.isempty(args.Transportation) 
		then
			table.insert( output, design.add_header('Paraphernalia', 2) )
			table.insert( output, design.add_section('Equipment', args.Equipment, 3) )
			table.insert( output, design.add_section('Weapons', args.Weapons, 3) )
			table.insert( output, design.add_section('Transportation', args.Transportation, 3) )
	end

	-- adds 'Notes', 'Trivia', 'See Also', 'Recommended Reading' and 'Links and References' sections
	---- links to standard sub-pages/categories - "Appearances", "Minor Appearances", Mentions", "Images", "Quotes" and "Gallery" 
	value, categories = design.add_notes_trivia_see_also_recommended_links_references(args, page_type, pagename)
	output_categories = h.join_tables(output_categories, categories)
	output = h.join_tables(output, value)

--
	output_categories = h.add_categories(output_categories)
	output = table.concat(output)
	
	return frame:preprocess(output)..output_categories
end


--------------------------------------------------------------------------------------------------
function p.lua_get_outdated_fields(args)
	local output = ''
	
	if  not h.isempty(args.Custom)
		or not h.isempty(args.CustomLabel)
		or not h.isempty(args.CustomSection1)
		or not h.isempty(args.CustomText1)
		or not h.isempty(args.CustomSection2)
		or not h.isempty(args.CustomText2)
		or not h.isempty(args.NotesHeader)
		or not h.isempty(args.TriviaHeader)
		or not h.isempty(args.HistoryHeader)
		or not h.isempty(args.RecommendedHeader)
		or not h.isempty(args.Universe2)
			then output = 'Outdated Fields/Team'
	end
	
	return output	
end


return p