Marvel Database
Marvel Database

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

-- module for Marvel Database:Organization 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 = 'Organization'
	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) 
			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) )

	-- 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

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.LinksHeader)
		or not h.isempty(args.HistoryHeader)
		or not h.isempty(args.ParaphernaliaHeader)
		or not h.isempty(args.RecommendedHeader)
			then output = 'Outdated Fields/Organizations'
	return output	

return p