FANDOM


local p = {}
 
local type_img_data = mw.loadData( 'Module:Inlinewow/img_filename' )
local type_order_data = mw.loadData( 'Module:Inlinewow/sort_order' )
local type_link_data = mw.loadData( 'Module:Inlinewow/img_link' )
local getArgs = require('Module:Arguments').getArgs
 
function p.Inlinegfx(frame) -- Implements {{Inlinewow}}
	local args = getArgs(frame)
	return p._Inlinegfx(args)
end
 
function p._Inlinegfx( args )
	local sort_tpl = '0'
	local img_type = args['type']
	if args['type'] == nil then -- use param 1, if no type=
	    img_type = args[1]
	elseif args[1] == nil then
	    img_type = ''
	end
	if img_type ~= nil then -- if not nil, make lowercase
		img_type = string.lower(img_type)
    end
	local img_filename = 'Inv_misc_questionmark.png'
	local img_wikitext = '[[File:' .. img_filename .. '|18px|link=]]'
	local img_link = 'Warcraft universe'
 
	if img_type ~= nil and type_link_data[img_type] ~= nil then
	    img_link = type_link_data[img_type]
	end
 
	if img_type ~= nil and type_img_data[img_type] ~= nil then
	    	img_filename = type_img_data[img_type]
	        img_wikitext = '[[File:' .. img_filename .. '|' .. img_link .. '|link=' .. img_link .. ']]'
    elseif img_type == nil then
        img_type = 'none'
    end
 
	if img_type ~= nil and type_order_data[img_type] ~= nil then
	    sort_tpl = type_order_data[img_type]
	end
 
	local img_span_link = mw.html.create('span')
	    :wikitext('<span style="display:none;">' .. sort_tpl .. '</span>' .. img_wikitext)
 
	return img_span_link
end
 
return p
Community content is available under CC-BY-SA unless otherwise noted.