Module:Card

local card = {}

-- Libraries of functions --

-- stands for High Frequency --local HF = require('Module:ComicsHF') -- Parses invocation parameters, trims whitespace, and removes blanks. local getArgs = require('Dev:Arguments').getArgs -- Gives the name of the current page. It's expensive, so we only do it once. -- The _G then makes it global, available to all page functions. _G.vars = { Pagename = mw.title.getCurrentTitle.text } _G.args = getArgs(frame, { trim = true, removeBlanks = true }) -- -- Public functions (called from a Template or article) -- -- -- Machine translation link -- use inside -- "label" is optional, and defaults to 📃 function card.translate(frame) local inv_args = getArgs(frame, { trim = true, frameOnly = true }) local language = inv_args[1] --assert(inv_args[1], 'No language code given for translation link.')[1] local parameter = inv_args[2] --assert(inv_args[2], 'No text given for translation link.')[1] local label = inv_args[3] or '📃' local URI = mw.uri.new( {       protocol = 'https',        host = 'translate.google.com',        path = '/#'..language..'/en/',--..mw.uri.encode(_G.args[parameter]),        } ) local element = mw.html.create('span'):addClass('sysop-show') :wikitext('['..tostring(URI)..' '..label..']'):allDone return tostring(element) end

-- Render ultimate type -- use inside function card.type(frame) local output = {} local type1 = _G.args['type'] or '' local type2 = _G.args['type2'] or nil local type3 = _G.args['type3'] or nil local type4 = _G.args['type4'] or nil local type1U = mw.getContentLanguage:ucfirst(type1) local switch = { [''] = "",       ['Equip Card'] = ""..type1U.." ", ['Tip Card'] = ""..type1U.." ", ['Strategy Card'] = ""..type1U.." ", ['FAQ Card'] = ""..type1U.." ", ['Illustration Card'] = ""..type1U.." ", ['Counter'] = ""..type1U.." ", }   local switch2 = { ['Flip'] = "Flip monster", ['Spirit'] = "Spirit monster", ['Union'] = "Union monster", ['Toon'] = "Toon monster", ['Gemini'] = "Gemini monster", ['Tuner'] = "Tuner monster", ['Dark Tuner'] = "Dark Tuner monster", }   if _G.args['type'] or type2 or type3 or type4 then table.insert(output, switch[type1] or ""..mw.getContentLanguage:ucfirst(type1).."|]] ") if type2 then table.insert(output, ""..type2.."") end if type3 then table.insert(output, ""..type3.." ") end if type4 then table.insert(output, ""..type4.." ") end end return table.concat(output, ' / ') end

function card.card_type end

function card.property end

function card.level end

-- Formats card sets in rows -- Detects if the content uses a wrapper template, or is data -- use inside function card.cardset_format (frame) local inv_args = getArgs(frame, { trim = true, frameOnly = true }) local out = {} -- no logic yet table.insert(out, _cardset_envelope(inv_args)) return table.concat(out) end

-- Internal functions (used in this and other Modules --

-- Create an envelope for existing tables function _cardset_envelope (inv_args) local envelope = mw.html.create('div') :addClass('mw-collapsible'):addClass('mw-collapsed') :attr('data-expandtext','Show'):attr('data-collapsetext','Hide') :wikitext(inv_args[1]):allDone return tostring(envelope) end

-- If card set content passed is only data, build a table around it function _cardset_table end

-- Build table rows for _cardset_table function _cardset_row end

- -- Output (send it back to whatever called it) -- - return card