Module:Reality Template

-- module for Marvel Database:Reality Template not to be confused with Module:Reality local p = {} local getArgs = require('Dev:Arguments').getArgs local h = require("Module:HF") local design = require('Module:Design') local m_reality = require("Module:Reality")

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

table.insert(output_categories, pagename) 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) table.insert( output, design.add_section('Points of Interest', args.PointsOfInterest, 2) ) table.insert( output, design.add_section('Residents', args.Residents, 2) )

-- 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.LinksHeader) or not h.isempty(args.HistoryHeader) or not h.isempty(args.PointsOfInterestHeader) or not h.isempty(args.ResidentsHeader) or not h.isempty(args.OtherMediaHeader) or not h.isempty(args.OtherMedia) or not h.isempty(args.RecommendedHeader) or not h.isempty(args.Marvel) or not h.isempty(args.DC) or not h.isempty(args.Wikipedia) or not h.isempty(args.Comicvine) then output = 'Outdated Fields/Reality' end return output end

-- function p.get_reality_number(frame) local args = getArgs(frame) local value = args.EarthNumber local info = {} local category = '' local output = 'Unknown'

info = m_reality.get_reality_info({value}) output = info.name if string.find(output, 'TRN') ~= nil then category = h.Category('Temporary Reality Numbers') end

return h.LinkToCategory(output, output)..category end

-- function p.get_aliases(frame) local args = getArgs(frame) local value = args.Aliases local output = '' if not h.isempty(value) then if h.exists('Category:'..value) then output = h.LinkToCategory(value, value) else output = value end end

return output end

return p