Module: Infobox character/arms gallery

From A Wiki of Ice and Fire
Jump to: navigation, search

Documentation for this module may be created at Module:Infobox character/arms gallery/doc

local getArgs = require('Module:Arguments').getArgs
local infobox_image = require('Module:InfoboxImage').InfoboxImage

local function generate_arms(arms)
    --This function generates small coat of arms icons
    return infobox_image({
        args = {
            image  = arms,
            size   = '30x40px',
            border = 'no',
            suppressplaceholder = 'no',
        }
    })
end

local p = {}

function p.main(frame)
    local args = getArgs(frame)

    local all_arms = mw.html.create('span')
	for i=1,20 do
		local arms = args[i]
		if arms then
			all_arms:wikitext(generate_arms(arms)):wikitext(" ")
		end
	end
    return tostring(all_arms)
end

return p