-- module for Marvel Database:Image Template
local p = {}
local getArgs = require('Dev:Arguments').getArgs
local h = require("Module:HF")
local SC = require("Module:StaffCorrection")
local reality = require("Module:Reality")
local design = require('Module:Design')
local standard = require("Module:StandardizedName")
function p.main(frame)
local args = getArgs(frame)
local value
local links = {}
local output = {}
table.insert(output, '__NOTOC__')
table.insert(output, design.add_section('Description', args.Description, 2) )
table.insert( output, design.add_section('Accolades', args.Accolades, 2) )
value = '\n* All [[Marvel Comics]] characters and the distinctive likeness(es) thereof are Trademarks & Copyright © 1941-'..os.date('*t').year..' Marvel Characters, Inc. ALL RIGHTS RESERVED.'
if not h.isempty(args.Notes)
then value = value..'\n'..args.Notes
end
table.insert( output, design.add_section('Notes', value, 2) )
table.insert( output, design.add_section('Trivia', args.Trivia, 2) )
table.insert(links, '[[Marvel Database:Image Policy|Our Image Policy]]')
table.insert(links, '[[Marvel Database:Copyrights|Our Copyright Policy]]')
table.insert(links, '[[Marvel Database:General disclaimer|General Disclaimer]]')
table.insert(links, 'http://en.wikipedia.org/wiki/Fair_Use')
table.insert(links, 'http://www.copyright.gov/title17/92chap1.html')
table.insert(links, 'http://www.copyright.gov/title17/92chap1.html#107')
table.insert(links, 'http://www.ipwatchdog.com/2012/10/05/copyright-fair-use-cases-of-the-united-states-supreme-court/id=26225/')
table.insert(links, 'http://en.wikipedia.org/wiki/GNU_Free_Documentation_License')
table.insert(links, 'http://www.gnu.org/copyleft/fdl.html')
links = '\n* '..mw.text.listToText(links, '\n* ', '\n* ')..'\n<references/>'
table.insert( output, design.add_section('Links and References', links, 2) )
return frame:preprocess(table.concat(output))
end
--------------------------------------------------------------------------------------------------
function p.top_message(frame)
local args = getArgs(frame)
local pagename = mw.title.getCurrentTitle().text
local reprint
local reprint_source
local reprint_content
local all_reprints = {}
local all_homages = {}
local homage
local homage_content
local homage_source
local external_homage_name = args.ExternalHomageName
local external_homage_link = args.ExternalHomageLink
local sorting_type = {}
local sorting_year = ''
local sort_name
local value
local number_of_reprints = h.pages_in_category(pagename..'/Reprints', 'files')
local number_of_homages = h.pages_in_category(pagename..'/Homages', 'files')
local message = ''
local title = ''
local help = ''
local help2 = ''
local output_categories = {}
local output = ''
_, _, sorting_type = p.lua_get_type(args)
_, _, sorting_year = p.lua_get_source(args)
if #sorting_type > 0
then sorting_type = mw.text.listToText(sorting_type, ' ', ' ')
else sorting_type = 'No'
end
sorting_type = 'IMAGETYPE:'..sorting_type..';'
sorting_year = 'IMAGEYEAR:'..sorting_year..';'
sort_name = '{{DEFAULTSORT:'..pagename..sorting_type..sorting_year..'|noerror}}'
if not h.isempty(args.ReprintOf)
then
for i = 1, 5 do
if i == 1
then reprint_source = args.ReprintOf
else reprint_source = args["ReprintOf"..i]
end
if not h.isempty(reprint_source)
then
value = string.gsub(reprint_source, 'File:', '')
reprint = p.sup_text(value..'/Reprints', '(all reprints of this image)')
table.insert(output_categories, 'Reprinted Images')
table.insert(output_categories, value..'/Reprints')
if not h.exists('Category:'..value..'/Reprints')
then table.insert(output_categories, 'Reprinted Image Category Needed')
end
value = h.Link(':File:'..value, value)
table.insert(all_reprints, value..' '..reprint)
end
end
title = 'This image is a reprint of:'
message = mw.text.listToText(all_reprints, '<br>', '<br>')
help = 'Information that was automatically fetched from original image(s) is '..design.span('italicized').italic
elseif not h.isempty(args.HomageOf)
then
table.insert(output_categories, 'Templated Images')
for i = 1, 5 do
if i == 1
then value = args.HomageOf
else value = args["HomageOf"..i]
end
if not h.isempty(value)
then
value = string.gsub(value, 'File:', '')
homage_content = p.image_content(value)
homage_source = h.get_field_value(homage_content, 'Source')
homage_source = standard.get_link({homage_source})
table.insert(output_categories, value..'/Homages')
if not h.exists('Category:'..value..'/Homages')
then table.insert(output_categories, 'Homaged Image Category Needed')
end
homage = p.sup_text(value..'/Homages', '(all homages of this image)')
value = h.Link(':File:'..value, 'File:'..value)
table.insert(all_homages, value..' from '.. homage_source.. ' '..homage)
end
end
title = 'This image is an homage of:'
message = mw.text.listToText(all_homages, '<br>', '<br>')
elseif not h.isempty(external_homage_name)
then
table.insert(output_categories, 'Templated Images')
table.insert(output_categories, external_homage_name..'/Homages')
title = 'This image is an homage of:'
message = external_homage_link..p.sup_text(external_homage_name..'/Homages', '(all homages of this image)')
else
table.insert(output_categories, 'Templated Images')
end
if number_of_reprints > 0 or number_of_homages > 0
then
number_of_reprints = design.lua_add_navigation_link(pagename..'/Reprints', 'Reprints', 'files')
number_of_homages = design.lua_add_navigation_link(pagename..'/Homages', 'Homages', 'files')
help2 = design.lua_add_navigation({number_of_homages, number_of_reprints})
end
if message ~= '' or help2 ~= ''
then output = design.lua_message({
title = title,
message = message,
help = help,
help2 = help2
})
end
table.insert(output_categories, p.lua_get_outdated_fields(args) )
return frame:preprocess(sort_name)..output..h.add_categories(output_categories)
end
--------------------------------------------------------------------------------------------------
function p.lua_get_outdated_fields(args)
local output = ''
if (
not h.isempty(args.ImageType)
and h.in_list( {'trading card', 'trading cards', 'card', 'episode'}, string.lower(args.ImageType) )
)
or not h.isempty(args.Issue)
or not h.isempty(args.Issue2)
or not h.isempty(args.Episode)
or not h.isempty(args.Movie)
or not h.isempty(args.Permission)
or not h.isempty(args.CoverArtists)
or not h.isempty(args.Title)
or not h.isempty(args.Colourist1)
or not h.isempty(args.Universe)
then output = 'Outdated Fields'
end
return output
end
--------------------------------------------------------------------------------------------------
function p.sup_text(value, link_text)
local output = ''
link_text = link_text or '(Images)'
if not h.isempty(value)
then
output = h.LinkToCategory(value, link_text)
output = mw.html.create('span')
:css('font-size', '80%')
:css('font-family', 'monospace')
:css('vertical-align', 'super')
:wikitext(output)
output = ' '..tostring(output)
end
return output
end
--------------------------------------------------------------------------------------------------
--checks if image is a reprint/homage
function p.image_content(value)
local output = ''
if not h.isempty(value)
then
value = 'File:'..string.gsub(value, 'File:', '')
if h.exists(value)
then output = h.get_content(value)
end
end
return output
end
--------------------------------------------------------------------------------------------------
function p.get_license(frame)
local args = getArgs(frame)
local reprint_content = p.image_content(args.ReprintOf)
local license = {
['gfdl'] = { 'GFDL', 'GFDL' },
['pd'] = { 'Public Domain Images', 'Public Domain' },
['public domain'] = { 'Public Domain Images', 'Public Domain' },
['fair use'] = { 'Fair Use Images', 'Fair Use' },
['fairuse'] = { 'Fair Use Images', 'Fair Use' },
['cover'] = { 'Fair Use (Comic Covers)', 'Fair Use (Comic Cover)' },
['comic cover'] = { 'Fair Use (Comic Covers)', 'Fair Use (Comic Cover)' },
['comic covers'] = { 'Fair Use (Comic Covers)', 'Fair Use (Comic Cover)' },
['cover art'] = { 'Fair Use (Comic Covers)', 'Fair Use (Comic Cover)' },
['csp'] = { 'Fair Use (Comic Single Panels)', 'Fair Use (Comic Single Panel)' },
['panel'] = { 'Fair Use (Comic Single Panels)', 'Fair Use (Comic Single Panel)' },
['single panel'] = { 'Fair Use (Comic Single Panels)', 'Fair Use (Comic Single Panel)' },
['comic single panel'] = { 'Fair Use (Comic Single Panels)', 'Fair Use (Comic Single Panel)' },
['comic single panels'] = { 'Fair Use (Comic Single Panels)', 'Fair Use (Comic Single Panel)' },
['cs'] = { 'Fair Use (Comic Scenes)', 'Fair Use (Comic Scene)' },
['scene'] = { 'Fair Use (Comic Scenes)', 'Fair Use (Comic Scene)' },
['comic scene'] = { 'Fair Use (Comic Scenes)', 'Fair Use (Comic Scene)' },
['comic scenes'] = { 'Fair Use (Comic Scenes)', 'Fair Use (Comic Scene)' },
['cp'] = { 'Fair Use (Comic Pages)', 'Fair Use (Comic Page)' },
['page'] = { 'Fair Use (Comic Pages)', 'Fair Use (Comic Page)' },
['comic page'] = { 'Fair Use (Comic Pages)', 'Fair Use (Comic Page)' },
['concept'] = { 'Fair Use (Concept Art Image)', 'Fair Use (Concept Art Image)' },
['concept art'] = { 'Fair Use (Concept Art Image)', 'Fair Use (Concept Art Image)' },
['concept art'] = { 'Fair Use (Concept Art Image)', 'Fair Use (Concept Art Image)' },
['tc'] = { 'Fair Use (Trading Cards)', 'Fair Use (Trading Card)' },
['card'] = { 'Fair Use (Trading Cards)', 'Fair Use (Trading Card)' },
['trading card'] = { 'Fair Use (Trading Cards)', 'Fair Use (Trading Card)' },
['trading cards'] = { 'Fair Use (Trading Cards)', 'Fair Use (Trading Card)' },
['novel'] = { 'Fair Use (Novel Images)', 'Fair Use (Novel Image)' },
['novels'] = { 'Fair Use (Novel Images)', 'Fair Use (Novel Image)' },
['book'] = { 'Fair Use (Novel Images)', 'Fair Use (Novel Image)' },
['books'] = { 'Fair Use (Novel Images)', 'Fair Use (Novel Image)' },
['game'] = { 'Fair Use (Game Screenshots)', 'Fair Use (Game Screenshot)' },
['games'] = { 'Fair Use (Game Screenshots)', 'Fair Use (Game Screenshot)' },
['video game'] = { 'Fair Use (Game Screenshots)', 'Fair Use (Game Screenshot)' },
['video games'] = { 'Fair Use (Game Screenshots)', 'Fair Use (Game Screenshot)' },
['videogame'] = { 'Fair Use (Game Screenshots)', 'Fair Use (Game Screenshot)' },
['videogames'] = { 'Fair Use (Game Screenshots)', 'Fair Use (Game Screenshot)' },
['game screenshot'] = { 'Fair Use (Game Screenshots)', 'Fair Use (Game Screenshot)' },
['game screenshots'] = { 'Fair Use (Game Screenshots)', 'Fair Use (Game Screenshot)' },
['video game screenshot'] = { 'Fair Use (Game Screenshots)', 'Fair Use (Game Screenshot)' },
['video game screenshots'] = { 'Fair Use (Game Screenshots)', 'Fair Use (Game Screenshot)' },
['videogame screenshot'] = { 'Fair Use (Game Screenshots)', 'Fair Use (Game Screenshot)' },
['videogame screenshots'] = { 'Fair Use (Game Screenshots)', 'Fair Use (Game Screenshot)' },
['film'] = { 'Fair Use (Movie Screenshots)', 'Fair Use (Movie Screenshot)' },
['movie'] = { 'Fair Use (Movie Screenshots)', 'Fair Use (Movie Screenshot)' },
['movie screenshot'] = { 'Fair Use (Movie Screenshots)', 'Fair Use (Movie Screenshot)' },
['movie screenshots'] = { 'Fair Use (Movie Screenshots)', 'Fair Use (Movie Screenshot)' },
['tv'] = { 'Fair Use (TV Screenshots)', 'Fair Use (TV Screenshot)' },
['tv screenshot'] = { 'Fair Use (TV Screenshots)', 'Fair Use (TV Screenshot)' },
['tv screenshots'] = { 'Fair Use (TV Screenshots)', 'Fair Use (TV Screenshot)' },
['database'] = { 'Fair Use (Database Screenshots)', 'Fair Use (Database Screenshot)' },
['database screenshot'] = { 'Fair Use (Database Screenshots)', 'Fair Use (Database Screenshot)' },
['database screenshots'] = { 'Fair Use (Database Screenshots)', 'Fair Use (Database Screenshot)' },
['software'] = { 'Fair Use (Software Screenshots)', 'Fair Use (Software Screenshot)' },
['software screenshot'] = { 'Fair Use (Software Screenshots)', 'Fair Use (Software Screenshot)' },
['software screenshots'] = { 'Fair Use (Software Screenshots)', 'Fair Use (Software Screenshot)' },
['promo'] = { 'Fair Use (Promotional Materials)', 'Fair Use (Promotional Material)' },
['promo material'] = { 'Fair Use (Promotional Materials)', 'Fair Use (Promotional Material)' },
['promo materials'] = { 'Fair Use (Promotional Materials)', 'Fair Use (Promotional Material)' },
['promotional material'] = { 'Fair Use (Promotional Materials)', 'Fair Use (Promotional Material)' },
['promotional materials'] = { 'Fair Use (Promotional Materials)', 'Fair Use (Promotional Material)' },
['promotional'] = { 'Fair Use (Promotional Materials)', 'Fair Use (Promotional Material)' },
['movie poster'] = { 'Fair Use (Posters)', 'Fair Use (Poster)' },
['movie posters'] = { 'Fair Use (Posters)', 'Fair Use (Poster)' },
['poster'] = { 'Fair Use (Posters)', 'Fair Use (Poster)' },
['posters'] = { 'Fair Use (Posters)', 'Fair Use (Poster)' },
['merch'] = { 'Fair Use (Merchandise Images)', 'Fair Use (Merchandise Image)' },
['merchandise'] = { 'Fair Use (Merchandise Images)', 'Fair Use (Merchandise Image)' },
['merchandise image'] = { 'Fair Use (Merchandise Images)', 'Fair Use (Merchandise Image)' },
['nft'] = { 'Fair Use (NFT)', 'Fair Use (NFT Image)' },
}
local info = { 'Unlicensed Images', 'Unlicensed' }
local value = ''
local output_categories = {}
local output = ''
if reprint_content ~= ''
then
if not h.isempty(args.License)
then value = args.License
else value = h.get_field_value(reprint_content, 'License')
end
else value = args.License
end
if not h.isempty(value) and license[string.lower(value)] ~= nil
then info = license[string.lower(value)]
end
output = h.LinkToCategory(info[1], info[2])
if reprint_content ~= '' and h.isempty(args.License)
then output = design.span(output).italic
else table.insert(output_categories, info[1])
end
if h.isempty(args.Source)
then
if string.find(info[1], 'Comic') ~= nil
then table.insert(output_categories, 'Image Source Needed (Issue)')
elseif info[1] == 'Fair Use (TV Screenshots)'
then table.insert(output_categories, 'Image Source Needed (Episode)')
elseif string.find(info[1], 'Movie') ~= nil
then table.insert(output_categories, 'Image Source Needed (Movie)')
elseif info[1] == 'Fair Use (Game Screenshots)'
then table.insert(output_categories, 'Image Source Needed (Video Game)')
end
end
if reprint_content == '' and string.find(info[1], 'Comic') ~= nil and info[1] ~= 'Fair Use (Comic Covers)' and h.isempty(args['Penciler1'])
then table.insert(output_categories, 'Image Penciler Needed')
end
return output..h.add_categories(output_categories)
end
--------------------------------------------------------------------------------------------------
function p.get_type(frame)
local args = getArgs(frame)
local output_categories = {}
local output = ''
output, output_categories = p.lua_get_type(args)
return output..h.add_categories(output_categories)
end
--------------------------------------------------------------------------------------------------
function p.get_reality(frame)
local args = getArgs(frame)
local reprint_content = p.image_content(args.ReprintOf)
local value
local category
local output_categories = {}
local output = ''
if reprint_content ~= ''
then value = h.get_field_value(reprint_content, 'Reality')
else value = args.Reality
end
if not h.isempty(value)
then
value = reality.get_reality_info({value, 1})
if value ~= nil
then
category = value..'/Images'
value = h.Link(value)
if reprint_content ~= ''
then value = design.span(value).italic
else table.insert(output_categories, category)
end
output = value..p.sup_text(category)
end
end
return output..h.add_categories(output_categories)
end
--------------------------------------------------------------------------------------------------
function p.get_subjects(frame)
local args = getArgs(frame)
local image_type = string.lower(args.ImageType or '')
local image_license = string.lower(args.License or '')
local identification_needed = 'Image Subject Identification Needed'
local identification_needed2 = 'Image Subject Identification Needed (Empty Subjects)'
local reprint_source
local reprint_content
local i
local j
local value
local category
local reprint_subjects = {}
local exclude_subjects = {}
local subjects = {}
local output_categories = {}
local output = ''
if h.isempty(args.ReprintOf)
then
value = args['Subject1']
if h.isempty(value)
then
if image_license ~= 'nft' and not h.in_list({'achievement', 'indicia', 'logo', 'non-marvel', 'signature', 'site', 'hub', 'icon', 'button', 'user image', 'user'}, image_type)
then table.insert(output_categories, 'Image Subject Needed')
end
elseif string.lower(value) == 'none'
then table.insert(output_categories, 'No Subject Image')
end
else
for i = 1, 200 do
value = args["ExcludeSubject"..i]
if not h.isempty(value)
then table.insert(exclude_subjects, value)
end
end
for j = 1, 5 do
if j == 1
then reprint_source = args.ReprintOf
else reprint_source = args["ReprintOf"..j]
end
if not h.isempty(reprint_source)
then
reprint_content = p.image_content(reprint_source)
for i = 1, 200 do
value = h.get_field_value(reprint_content, 'Subject'..i)
if not h.isempty(value) and string.lower(value) ~= 'none' and not h.in_list(reprint_subjects, value) and (#exclude_subjects == 0 or not h.in_list(exclude_subjects, value) )
then
table.insert(reprint_subjects, value)
category = p.sup_text(value..'/Images')
value = design.span( h.Link(value) ).italic
table.insert(subjects, value..category)
end
end
end
end
end
--[[
if #reprint_subjects > 0
then
for i = 1, #reprint_subjects do
category = p.sup_text(reprint_subjects[i]..'/Images')
value = design.span( h.Link(reprint_subjects[i]) ).italic
table.insert(subjects, value..category)
end
end
]]--
-- this part is left outside of reprint check, because some reprinted images have additional details, not present on original image, but are otherwise still a reprint.
for i = 1, 200 do
value = args['Subject'..i]
if not h.isempty(value) and string.lower(value) ~= 'none'
then
if value == '?'
then
table.insert(output_categories, identification_needed)
table.insert(subjects, 'Identification Needed' )
else
category = value..'/Images'
table.insert(output_categories, category)
table.insert(subjects, h.Link(value)..p.sup_text(category) )
end
else
if not h.isempty(args['Subject'..i+1])
then
table.insert(output_categories, identification_needed2)
table.insert(subjects, 'Identification Needed' )
end
end
end
if #subjects > 0
then
if #subjects > 1
then output = '*'..mw.text.listToText(subjects, '\n*', '\n*')
else output = table.concat(subjects)
end
end
return output..h.add_categories(output_categories)
end
--------------------------------------------------------------------------------------------------
function p.get_source(frame)
local args = getArgs(frame)
local output_categories = {}
local output = ''
output, output_categories = p.lua_get_source(args)
return output..h.add_categories(output_categories)
end
--------------------------------------------------------------------------------------------------
function p.get_medium(frame)
local args = getArgs(frame)
local reprint_content = p.image_content(args.ReprintOf)
local output = ''
if reprint_content ~= ''
then output = h.get_field_value(reprint_content, 'Medium')
else output = args.Medium
end
if h.isempty(output)
then output = ''
elseif reprint_content ~= ''
then output = design.span(value).italic
end
return output
end
--------------------------------------------------------------------------------------------------
function p.get_photographer(frame)
local args = getArgs(frame)
local reprint_content = p.image_content(args.ReprintOf)
local value
local category
local output_categories = {}
local output = ''
if reprint_content ~= ''
then value = h.get_field_value(reprint_content, 'Photographer')
else value = args.Photographer
end
if not h.isempty(value)
then
value, category = SC.lua_get_staff_link_and_category(value, 'Photographer Images')
if reprint_content ~= ''
then value = design.span(value).italic
else table.insert(output_categories, category)
end
output = value..p.sup_text(category)
end
return output..h.add_categories(output_categories)
end
--------------------------------------------------------------------------------------------------
function p.get_creator(frame)
local args = getArgs(frame)
local reprint_source
local reprint_content
local field_name = args.field
local category_name
local i
local j
local k
local value
local category
local staff_for_reprinted_cover = {'Penciler', 'Inker', 'Colorist', 'CoverArtist'}
local reprint_artists = {}
local exclude_artists = {}
local output_categories = {}
local output = {}
if field_name == 'CoverArtist'
then category_name = 'Cover Artist'
else category_name = field_name
end
if not h.isempty(args.ReprintOf)
then
for i = 1, 10 do
value = args["ExcludeArtist"..i]
if not h.isempty(value)
then table.insert(exclude_artists, value)
end
end
if not h.isempty(args.License) and string.find(string.lower(args.License), 'cover') ~= nil
then
for k = 1, 5 do
if k == 1
then reprint_source = args.ReprintOf
else reprint_source = args["ReprintOf"..k]
end
if not h.isempty(reprint_source)
then
reprint_content = p.image_content(reprint_source)
if field_name == 'CoverArtist'
then
for j = 1, #staff_for_reprinted_cover do
if staff_for_reprinted_cover[j] ~= 'CoverArtist'
then category_name = staff_for_reprinted_cover[j]
else category_name = 'Cover Artist'
end
for i = 1, 10 do
value = h.get_field_value(reprint_content, staff_for_reprinted_cover[j]..i)
if not h.isempty(value)
then
if not h.in_list(reprint_artists, value) and (#exclude_artists == 0 or not h.in_list(exclude_artists, value))
then
table.insert(reprint_artists, value)
value, category = SC.lua_get_staff_link_and_category(value, category_name..' Images')
category = p.sup_text(category)
value = design.span(value).italic
table.insert(output, value..category)
end
end
end
end
end
end
end
else
for k = 1, 5 do
if k == 1
then reprint_source = args.ReprintOf
else reprint_source = args["ReprintOf"..k]
end
if not h.isempty(reprint_source)
then
reprint_content = p.image_content(reprint_source)
for i = 1, 10 do
value = h.get_field_value(reprint_content, field_name..i)
if not h.isempty(value)
then
value, category = SC.lua_get_staff_link_and_category(value, category_name..' Images')
if not h.in_list(reprint_artists, value) and (#exclude_artists == 0 or not h.in_list(exclude_artists, value))
then
table.insert(reprint_artists, value)
category = p.sup_text(category)
value = design.span(value).italic
table.insert(output, value..category)
end
end
end
end
end
end
end
-- this part is left outside of reprint check, because some reprinted images have additional details, not present on original image, but are otherwise still a reprint.
for i = 1, 10 do
value = args[field_name..i]
if not h.isempty(value)
then
value, category = SC.lua_get_staff_link_and_category(value, category_name..' Images')
table.insert(output_categories, category)
category = p.sup_text(category)
table.insert(output, value..category)
end
end
output = mw.text.listToText(output, '<br />', '<br />')
return output..h.add_categories(output_categories)
end
--------------------------------------------------------------------------------------------------
function p.get_cover_series(frame)
local args = getArgs(frame)
local i
local value
local category
local output_categories = {}
local output = {}
for i = 1, 20 do
category = args['PartOf'..i]
if not h.isempty(category)
then
value = string.gsub(category, ' Variants', '')
table.insert(output, h.LinkToCategory(category, value))
table.insert(output_categories, category)
end
end
if #output > 1
then output = '*'..mw.text.listToText(output, '\n*', '\n*')
else output = table.concat(output)
end
return output..h.add_categories(output_categories)
end
-- ********************************************************************************************************
--------------------------------------------------------------------------------------------------
function p.lua_get_type(args)
local pagename = mw.title.getCurrentTitle().text
local reprint_content = p.image_content(args.ReprintOf)
local image_type = {
['cover'] = { 'Cover Art Images', 'Cover' },
['cover art'] = { 'Cover Art Images', 'Cover' },
['back'] = { 'Back Cover Images', 'Back Cover' },
['back cover'] = { 'Back Cover Images', 'Back Cover' },
['wraparound cover'] = { 'Wraparound Cover Images', 'Wraparound Cover' },
['wrap-around cover'] = { 'Wraparound Cover Images', 'Wraparound Cover' },
['wrap around cover'] = { 'Wraparound Cover Images', 'Wraparound Cover' },
['wraparound'] = { 'Wraparound Cover Images', 'Wraparound Cover' },
['wrap-around'] = { 'Wraparound Cover Images', 'Wraparound Cover' },
['wrap around'] = { 'Wraparound Cover Images', 'Wraparound Cover' },
['foldout cover'] = { 'Gatefold Cover Images', 'Gatefold Cover' },
['fold out cover'] = { 'Gatefold Cover Images', 'Gatefold Cover' },
['fold-out cover'] = { 'Gatefold Cover Images', 'Gatefold Cover' },
['folded cover'] = { 'Gatefold Cover Images', 'Gatefold Cover' },
['fold out'] = { 'Gatefold Cover Images', 'Gatefold Cover' },
['foldout'] = { 'Gatefold Cover Images', 'Gatefold Cover' },
['fold-out'] = { 'Gatefold Cover Images', 'Gatefold Cover' },
['gatefold'] = { 'Gatefold Cover Images', 'Gatefold Cover' },
['gate-fold'] = { 'Gatefold Cover Images', 'Gatefold Cover' },
['folded'] = { 'Gatefold Cover Images', 'Gatefold Cover' },
['variant cover'] = { 'Variant Covers', 'Variant Cover' },
['variants cover'] = { 'Variant Covers', 'Variant Cover' },
['variable cover'] = { 'Variant Covers', 'Variant Cover' },
['variant'] = { 'Variant Covers', 'Variant Cover' },
['variants'] = { 'Variant Covers', 'Variant Cover' },
['variable'] = { 'Variant Covers', 'Variant Cover' },
['solicit'] = { 'Solicit Cover Images', 'Solicit Cover' },
['solicits'] = { 'Solicit Cover Images', 'Solicit Cover' },
['solicit cover'] = { 'Solicit Cover Images', 'Solicit Cover' },
['solicits cover'] = { 'Solicit Cover Images', 'Solicit Cover' },
['solicitation cover'] = { 'Solicit Cover Images', 'Solicit Cover' },
['solicitations cover'] = { 'Solicit Cover Images', 'Solicit Cover' },
['solicitation'] = { 'Solicit Cover Images', 'Solicit Cover' },
['solicitations'] = { 'Solicit Cover Images', 'Solicit Cover' },
['textless'] = { 'Textless Cover Images', 'Textless Cover' },
['no text'] = { 'Textless Cover Images', 'Textless Cover' },
['textless cover'] = { 'Textless Cover Images', 'Textless Cover' },
['no text cover'] = { 'Textless Cover Images', 'Textless Cover' },
['2nd printing cover'] = { 'Second Printing Variants', '2nd Printing Cover' },
['2nd printing'] = { 'Second Printing Variants', '2nd Printing Cover' },
['second-printing cover'] = { 'Second Printing Variants', '2nd Printing Cover' },
['second printing cover'] = { 'Second Printing Variants', '2nd Printing Cover' },
['second-printing'] = { 'Second Printing Variants', '2nd Printing Cover' },
['second printing'] = { 'Second Printing Variants', '2nd Printing Cover' },
['character'] = { 'Character Images', 'Character' },
['character image'] = { 'Character Images', 'Character' },
['char'] = { 'Character Images', 'Character' },
['teams'] = { 'Team Images', 'Team' },
['team'] = { 'Team Images', 'Team' },
['vehicles'] = { 'Vehicle Images', 'Vehicle' },
['vehicle'] = { 'Vehicle Images', 'Vehicle' },
['organization'] = { 'Organization Images', 'Organization' },
['item'] = { 'Item Images', 'Item' },
['reality'] = { 'Reality Images', 'Reality' },
['location'] = { 'Location Images', 'Location' },
['event'] = { 'Event Images', 'Event' },
['race'] = { 'Race Images', 'Race' },
['scene'] = { 'Scene Images', 'Scene' },
['creator'] = { 'Creator Images', 'Creator' },
['staff'] = { 'Creator Images', 'Creator' },
['staff members'] = { 'Creator Images', 'Creator' },
['members'] = { 'Creator Images', 'Creator' },
['marvel staff'] = { 'Creator Images', 'Creator' },
['non-marvel'] = { 'Non-Marvel Images', 'Non-Marvel Image' },
['user image'] = { 'User Images', 'User' },
['user'] = { 'User Images', 'User' },
['logo'] = { 'Logo Images', 'Logo' },
['site'] = { 'Site Images', 'Site' },
['hub'] = { 'Hub Images', 'Hub' },
['indicia'] = { 'Indicia Images', 'Indicia' },
['map'] = { 'Map Images', 'Map' },
['flag'] = { 'Flag Images', 'Flag' },
['achievement'] = { 'Achievement Images', 'Achievement' },
['button'] = { 'Button Icons', 'Button Icon' },
['icon'] = { 'Main Page Icons', 'Main Page Icon' },
['signature'] = { 'Signature Images', 'Signature' },
}
local value = args['ImageType']
local info = { 'Images of Unknown Type', 'Unknown Type' }
local function get_type_link(value)
if not h.isempty(value) and image_type[string.lower(value)] ~= nil
then info = image_type[string.lower(value)]
end
return h.LinkToCategory(info[1], info[2])
end
local sorting_type = {}
local output_categories = {}
local output = ''
if string.find(pagename, ' Textless') ~= nil
then
table.insert(output_categories, 'Textless Cover Images')
table.insert(sorting_type, 'Textless')
end
if string.find(pagename, ' Wraparound') ~= nil
then
table.insert(output_categories, 'Wraparound Cover Images')
table.insert(sorting_type, 'Cover')
end
if string.find(pagename, ' Gatefold') ~= nil
then
table.insert(output_categories, 'Gatefold Cover Images')
table.insert(sorting_type, 'Cover')
end
if string.find(pagename, ' Virgin Variant') ~= nil
then
table.insert(output_categories, 'Virgin Variants')
table.insert(sorting_type, 'Textless')
end
if not h.isempty(value)
then
output = get_type_link(value)
table.insert(output_categories, info[1])
elseif reprint_content ~= ''
then
value = h.get_field_value(reprint_content, 'ImageType')
output = design.span( get_type_link(value) ).italic
end
if string.find(info[1], 'Cover') ~= nil
then
if h.isempty(args['Source'])
then table.insert(output_categories, 'Image Source Needed (Issue)')
end
if reprint_content == '' and h.isempty(args['CoverArtist1'])
then table.insert(output_categories, 'Image Cover Artist Needed')
end
end
if info[2] == 'Textless Cover'
then table.insert(sorting_type, 'Textless')
end
if info[2] == 'Variant Cover'
then table.insert(sorting_type, 'Variant')
end
if h.in_list({'Cover', 'Wraparound Cover', 'Gatefold Cover', 'Solicit Cover', '2nd Printing Cover'}, info[2])
then table.insert(sorting_type, 'Cover')
end
if h.in_list({'Character', 'Team', 'Organization', 'Item', 'Vehicle', 'Reality', 'Location', 'Event', 'Race', 'Scene'}, info[2])
then
table.insert(sorting_type, 'Interior')
table.insert(sorting_type, info[2])
end
return output, output_categories, sorting_type
end
--------------------------------------------------------------------------------------------------
function p.lua_get_source(args)
local value = args.Source
local category
local sorting_year = ''
local info = {}
local output_categories = {}
local output = ''
if value
then
if string.find(value, 'http') == nil
then
value, category = standard.lua_replace_number_sign(value)
table.insert(output_categories, category)
if string.find(value, ' Vol ') ~= nil or string.find(value, ' Season ') ~= nil
then
if string.find(value, ' Vol ') ~= nil
then info = standard.lua_get_title_volume_issue(value, 'Vol')
else info = standard.lua_get_title_volume_issue(value, 'Season')
end
table.insert(output_categories, info.noissue..'/Images')
if info.noissue ~= value
then table.insert(output_categories, info.all..'/Images')
end
else
table.insert(output_categories, value..'/Images')
end
value, sorting_year = standard.lua_get_link_and_release_date(value)
if sorting_year
then sorting_year = string.match(sorting_year, '.+(%d%d%d%d).+')
end
if h.isempty(sorting_year)
then sorting_year = '9999'
end
end
output = value
end
return output, output_categories, sorting_year
end
return p