Module:Card

require('Module:WikiLink')

local p = {} local metahtml = getmetatable(mw.html.create).__index local params = { colBack = "#17111b"; colBorder = "#000000"; colLight = "#70547c"; cardHeight = 150; } 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:5px;font-size:15px;font-family:"Franklin Gothic";line-height:100%;padding-right:' .. tonumber((params.cardHeight / 2)+5) ..'px') box:tag('div'):addClass('card-left') :cssText('position:absolute;top:30px;left:5px;display:flex;flex-flow:column wrap') :wikitext(args.left) box:tag('div'):addClass('card-right') :cssText('position:absolute;top:30px;right:5px;display:flex;flex-flow:column wrap;align-items:flex-end') :wikitext(args.right)

box:tag('div'):addClass('card-rightSeries') :cssText('display:flex;flex-direction:column;overflow:hidden;outline:2px solid' .. params.colBorder .. ';position:absolute;top:0%;right:0%;width:' .. tonumber((params.cardHeight / 2)+5) ..'px;height:50%; align-items:center;justify-content:center; text-align:center;background:' .. params.colBack .. ';color:#eee;') :wikitext(args.rightSeries) box:tag('div'):addClass('card-rightName') :cssText('display:flex;overflow:hidden;outline:2px solid' .. params.colBorder .. ';position:absolute;top:50%;right:0%;width:' .. tonumber((params.cardHeight / 2)+5) ..'px;height:50%;align-items:center;justify-content:center;text-align:center;background:' .. params.colBack .. ';color:#eee;') :wikitext(args.rightName)

if args.bottom and args.bottom~='' then box:tag('div'):addClass('card-bottom') :cssText('outline:2px solid' .. params.colBorder .. ';text-align:center;color:#17111b;background:#eee;height:150px;object-fit:cover') :wikitext(args.bottom) end return self end

function wikilink(strArg) local str = strArg mw.logObject(str) local table = strSplit(str,",\n") mw.logObject(table)

local res = "" local ind = table[1] local customLink = ind:match("%{.*%}") local wikiTerm = ind:match("%[.*%]") local indSub = ind:gsub("&#8203;", ""):gsub("&shy;", ""):gsub("­",""):gsub("",""):gsub("",""):gsub(" -%(.*%) -","") local wikiString = " ".. ind .." " if (wikiTerm ~= nil) then mw.logObject("wikiterm: " .. wikiTerm) --indTemp = wikiTerm:gsub("[%[%]]","") --ind = ind:gsub(" ?%[.*%] ?","") wikiString = "wikipedia:".. wikiTerm:gsub("[%[%","") .."| ".. ind:gsub(" ?%[.*%] ?","") .." ]]" elseif (customLink ~= nil) then mw.logObject("customLink: " .. customLink) ind = ind:gsub(" ?%{.*%} ?",""):gsub(" ?%[.*%] ?","") wikiString = " [".. customLink:gsub("[%{%}]","") .." ".. ind:gsub("[%[%]]","") .." ] " end mw.logObject("wikistring: "..wikiString) if (i > 1) then res = res .. ""	end res = res .. wikiString mw.logObject("res: "..res) return res end

function metahtml:Card(args, style) local arg2 = {} style = style or {} arg2.size = style.Size or '144px' arg2.rightSeries = wikilink(args.Series) arg2.rightName = ' '.. args.Name ..' ' arg2.right = args.Right~='' and args.Right or nil arg2.bottom = args.Image~='' and " " or "" return self:_card(arg2) end

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