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..nwData[v]..', '		end		-- Remove the trailing ', ' and close the span.		output = mw.ustring.sub(output, 1, -3)..') '	end	-- return output end

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

return MTGapps