FANDOM


-- <nowiki>
--
-- This module implements [[Templat:CCG]].
 
local p = {}
 
function p._main(args)
	args[1] = args[1] or '{{{1}}}'
 
	local ret = {}
	ret[#ret + 1] = string.format(
		"[[Berkas:SWCCGsmall.jpeg|x15px|link=Star Wars Customizable Card Game]] ''[[Star Wars Customizable Card Game]]'' &ndash; ''[[%s]]''",
		args[1]
	)
 
	if args.link or args.cardname then
		args.cardname = args.cardname or '{{{cardname}}}'
		local cardText
		if args.link and args.nourl then
			cardText = string.format('[[%s|%s]]', args.link, args.cardname)
		elseif args.link then
			cardText = string.format(
				'[http://www.starwarsccg.org/cardlists/images/starwars/%s %s]',
				args.link,
				args.cardname
			)
		else
			cardText = args.cardname
		end
		ret[#ret + 1] = string.format(
			'&nbsp;<small class="plainlinks">(Card: %s)</small>',
			cardText
		)
	end
 
	return table.concat(ret)
end
 
function p.main(frame)
	local args = {}
	for k, v in pairs(frame:getParent().args) do
		v = v:match('^%s*(.-)%s*$') -- trim whitespace
		if v ~= '' then
			args[k] = v
		end
	end
	return p._main(args)
end
 
return p
 
-- </nowiki>