Module:MTGapps

local MTGapps = {} --- imported libraries -- Parses invocation and template parameters, trims whitespace, and removes blanks. local getArgs = require('Dev:Arguments').getArgs --- local data with allowed abbreviations. local mtgData = mw.loadData( 'Module:MTGapps/data' ) -- This is the default output if no arguments are specified. local output = "Magic: The Gathering" -- This is the size for all the icons. local iconSize = "20px" -- This is the publisher of the MTG cards local publisher = "Wizards of the Coast"

-- function MTGapps.MTGAppearances (frame) -- interprets parameters local args = getArgs(frame) -- calls the internal function that does most of the work -- sends the result back to the template / article return MTGapps._MTGAppearances(args) end

-- function MTGapps.CiteMTG (frame) -- interprets parameters local args = getArgs(frame) -- calls the internal function that does most of the work -- sends the result back to the template / article return MTGapps._CiteMTG(args) end

function MTGapps._MTGAppearances(args) if args[1] then output = output..' ('		for _,v in ipairs(args) do			output = output....v....' • '		end		-- Remove the trailing ' • ' and close the span.		output = mw.ustring.sub(output, 1, -4)..') ' end

return output end

function MTGapps._CiteMTG(args) local set, card_number, name, illustrator if args[1] or args["set"] then set = args[1] or args["set"] output = output..' ('..mtgData[set][1]..'). ' -- add date output = output..'' -- add icon output = output..' '..set..'' -- add link to set end if args[2] or args["card number"] then card_number = args[2] or args["card number"] output = output..' #'..card_number -- add card number end if args[3] or args["name"] then name = args[3] or args["name"] output = output..' "'..name..'"' -- add card name end if args[4] or args["illustrator"] then illustrator = args[4] or args["illustrator"] output = output..', illus. '..illustrator..'.' -- add illustrator end output = output..' '..publisher..'.' -- add publisher return output end

return MTGapps