FANDOM


local Icon = {}
local HF = require('Module:HF')
local getArgs = require('Module:Arguments').getArgs
 
local data = mw.loadData( 'Module:Icon/data' )
local common = data.common
local HFdata = mw.loadData( 'Module:HF/data' )
local SC = HFdata.StoryCategories
 
-- The plan is to have some shortcut data for the stories and other common icons.
 
function Icon.main(frame)
-- Implements {{Icon}}
	local args = getArgs(frame)
	return Icon._icon(args)
end
 
function Icon._icon( args )
	local iconargs = {}
	local icontext = {}
-- Come to think of it, args.common really should be args[1], but I have to see if that will break something.
	iconargs.image = args['image'] or common[args.common] or common[args.story] or common['AHSW']
	iconargs.size = args['size'] or '25px'
	iconargs.align = args['align'] or 'middle'
	iconargs.link = args['link'] or ''
--	iconargs.label = args['label'] or args['story'] or ''
 
	iconargs.additional = args['additional']
	iconargs.additional_image = args['additional_image'] or common['AHSW']
	iconargs.additional_size = args['additional_size'] or '25px'
	iconargs.additional_align = args['additional_align'] or 'middle'
	iconargs.additional_link = args['additional_link']
--	iconargs.additional_label = args['additional_label']
 
	if (HF.isempty(iconargs.link) and SC[args.story]) then
	  iconargs.link = ':'..SC[args.story]
	end
 
	if (args['additional'] == 'character' and SC[args.story]) then
	  iconargs.additional_image = common['characters']
	  iconargs.additional_link = ':'..SC[args.story]..'/Characters'
--	  iconargs.additional_label = args.story .. ' Characters'
	end
 
	if (args['additional'] == 'episode' and SC[args.story]) then
	  iconargs.additional_image = common['episodes']
	  iconargs.additional_link = ':'..SC[args.story]..'/Episodes'
--	  iconargs.additional_label = args.story .. ' Episodes'
	end
 
	table.insert(icontext, '[[')
	table.insert(icontext, iconargs['image'] .. '|')
	table.insert(icontext, iconargs['size'] .. '|')
	table.insert(icontext, iconargs['align'] .. '|')
--	table.insert(icontext, iconargs['label'] .. '|')
	table.insert(icontext, 'link=' .. iconargs['link'] .. '|')
	table.insert(icontext, ']]')
 
	if iconargs['additional'] then
	  table.insert(icontext, '[[')
	  table.insert(icontext, iconargs['additional_image'] .. '|')
	  table.insert(icontext, iconargs['additional_size'] .. '|')
	  table.insert(icontext, iconargs['additional_align'] .. '|')
	  if not HF.isempty( iconargs['additional_link'] ) then 
	    table.insert(icontext, 'link=' .. iconargs['additional_link'] .. '|')
	  end
	  if not HF.isempty( iconargs['additional_label'] ) then 
	    table.insert(icontext, 'alt=' .. iconargs['additional_label'] .. '|')
	  end
	  table.insert(icontext, ']]')
	end
 
	return table.concat(icontext)
end
 
return Icon

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.