Module:Card

local p = {} local metahtml = getmetatable(mw.html.create).__index

function metahtml:_card(args) local size = tonumber(args.size:match'(%d+)') or 144 local box = self:tag('div') box:addClass('loliCard') :cssText('position:relative;display:inline-flex;flex-direction:column;margin:3px;font-size:11px') box:tag('div'):addClass('alc-top') :cssText('border:2px solid #444;font-weight:bold;border-bottom:none;text-align:center;background:#444;color:#eee;padding:2px;width:'..(size-4)..'px') :wikitext(args.top) box:tag('div'):addClass('alc-left') :cssText('position:absolute;top:30px;left:5px;display:flex;flex-flow:column wrap') :wikitext(args.left) box:tag('div'):addClass('alc-right') :cssText('position:absolute;top:30px;right:5px;display:flex;flex-flow:column wrap;align-items:flex-end') :wikitext(args.right) if args.bottom and args.bottom~='' then box:tag('div'):addClass('alc-bottom') :cssText('border:2px solid #444;text-align:center;color:#444;background:#eee;padding:2px 5px;width:'..(size-10)..'px') :wikitext(args.bottom) end return self end

function metahtml:Card(args, style) local arg2 = {} style = style or {} arg2.img = '' arg2.size = style.Size or '144px' arg2.top = args.Name~='' and args.Name~='Unknown' and ' '..args.Name..' ' arg2.left = args.Left~= and args.Left or args.Type~= and '' or nil arg2.right = args.Right~='' and args.Right or nil arg2.bottom = args.Bottom~='' and args.Bottom or nil return self:_card(arg2) end

function p.Card(args, style) return mw.html.create:Card(args, style) end