Documentation for this module may be created at Module:Story Arc Template/doc
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 = args.page_type
local label
local value
local categories = {}
local output_categories = {}
local output = {}
table.insert(output_categories, p.lua_get_outdated_fields(args, page_type) )
-- sections
value, categories = design.add_quote(args)
output_categories = h.join_tables(output_categories, categories)
table.insert(output, value)
value = args.Synopsis or args.FullSynopsis
if h.isempty(value)
then
value = 'Synopsis not yet written.'
table.insert(output_categories, page_type..' Synopsis Needed')
end
table.insert(output, design.add_section('Synopsis', value, 2) )
table.insert(output, design.add_section('Prelude', args.Prelude, 2) )
value = p.lua_get_parts(args)
if h.exists('Category:'..pagename)
then label = h.LinkToCategory(pagename, 'Issues')
else label = 'Issues'
end
table.insert(output, design.add_section(label, value, 2) )
table.insert(output, design.add_section('Tie-Ins', args.TieIns, 3) )
table.insert(output, design.add_section('Aftermath', args.Aftermath, 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, page_type)
local i
local output = ''
if not h.isempty(args.DescriptionHeader)
or not h.isempty(args.HistoryText)
or not h.isempty(args.IssuesHeader)
or not h.isempty(args.ParaphernaliaHeader)
or not h.isempty(args.Items)
or not h.isempty(args.Vehicles)
or not h.isempty(args.Weapons)
or not h.isempty(args.TriviaHeader)
or not h.isempty(args.LinksHeader)
or not h.isempty(args.HistoryHeader)
or not h.isempty(args.RecommendedHeader)
or not h.isempty(args.NotesHeader)
or not h.isempty(args.RecommendedReading)
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.CustomLabel)
or not h.isempty(args.Custom)
or not h.isempty(args.ImageSize)
or not h.isempty(args.ImageText)
or not h.isempty(args.Universe)
or not h.isempty(args.Enemies)
or not h.isempty(args.FullSynopsisHeader)
or not h.isempty(args.FullSynopsis)
or not h.isempty(args.Description)
or not h.isempty(args.Issues)
or not h.isempty(args.EventImage)
then output = 'Outdated Fields/'..page_type
end
for i = 1, 25 do
if not h.isempty(args['Synopsis'..i])
or not h.isempty(args['NamePart'..i])
or not h.isempty(args['ImagePart'..i])
then output = 'Outdated Fields/'..page_type
end
end
return output
end
--------------------------------------------------------------------------------------------------
function p.get_reality(frame)
local args = getArgs (frame)
local value = args.Reality
local list = {}
local i
local output = {}
if not h.isempty(value)
then
list = h.explode(';', value)
for i = 1, #list do
value = require("Module:Reality").get_reality_info({list[i]}).name
value = h.Link(value, value)
table.insert(output, value)
end
end
return mw.text.listToText(output, ', ', ', ')
end
--------------------------------------------------------------------------------------------------
function p.get_staff(frame)
local SC = require("Module:StaffCorrection")
local args = getArgs(frame)
local output
output, _ = SC.lua_get_list_of_staff(args.Creators, 'Creator')
return output
end
--------------------------------------------------------------------------------------------------
function p.lua_get_parts(args)
local standard = require("Module:StandardizedName")
local pagename
local content
local cover
local link
local i
local output = {}
for i = 1, 50 do
pagename = args['Part'..i]
if not h.isempty(pagename)
then
link = standard.lua_standardized_link(pagename)
pagename = h.break_link(link, 1)
content = h.get_content(pagename)
cover = h.get_field_value(content, 'Image')
if h.isempty(cover)
then cover = 'No Image Cover.jpg'
end
table.insert(output, '\n'..cover..'|'..link..'|link='..pagename)
end
end
if not h.isempty(output)
then
output = table.concat(output)
output = '<gallery position="center" captionalign="center" captionsize="large" navigation="true" hideaddbutton="true">'..output..'</gallery>'
else
output = ''
end
return output
end
return p