Nie podano opisu zmian |
Nie podano opisu zmian |
||
Linia 74: | Linia 74: | ||
:done() |
:done() |
||
:tag('default') |
:tag('default') |
||
− | :wikitext(card.frakcja) |
+ | :wikitext('[[File:'..card.frakcja..'|x48px|link='..card.frakcja..']]') |
:done() |
:done() |
||
:done() |
:done() |
||
Linia 82: | Linia 82: | ||
:done() |
:done() |
||
:tag('default') |
:tag('default') |
||
− | :wikitext(card.sila) |
+ | :wikitext('[[File:'..card.sila..'|x48px|link=]]') |
:done() |
:done() |
||
:done() |
:done() |
||
Linia 90: | Linia 90: | ||
:done() |
:done() |
||
:tag('default') |
:tag('default') |
||
− | :wikitext(card.werbunek) |
+ | :wikitext('[[File:'..card.werbunek..'|x48px|link=]]') |
:done() |
:done() |
||
:done() |
:done() |
Wersja z 12:58, 16 lut 2019
Dokumentacja dla tego modułu może zostać utworzona pod nazwą Moduł:Karta/opis
local p = {}
local data = mw.loadData('Module:Karty')
function p.main(frame)
local title = frame.args[1] or mw.title.getCurrentTitle().text
local card = data[title]
if not card then
return 'Nie znaleziono karty "'..title..'".'
end
local image = title:gsub(':', ''):gsub(' ', '_') .. '.png'
local art = title:gsub(':', ''):gsub(' ', '_') .. '_Art.jpg'
local premium = title:gsub(':', ''):gsub(' ', '_') .. '_Premium.gif'
local infobox = mw.html.create('infobox'):attr('type', 'card')
infobox
:tag('title')
:tag('default')
:wikitext(title)
:done()
:done()
:tag('group')
:attr('name', 'content')
:tag('group')
:attr('name', 'image')
:tag('panel')
:tag('section')
:tag('label')
:wikitext('Karta')
:done()
:tag('image')
:tag('default')
:wikitext(image)
:done()
:done()
:done()
:tag('section')
:tag('label')
:wikitext('Obraz')
:done()
:tag('image')
:tag('default')
:wikitext(art)
:done()
:done()
:done()
:tag('section')
:tag('label')
:wikitext('Premium')
:done()
:tag('image')
:tag('default')
:wikitext(premium)
:done()
:done()
:done()
:done()
:done()
:tag('group')
:attr('name', 'data')
:tag('panel')
:tag('section')
:tag('label')
:wikitext('Informacje')
:done()
:tag('group')
:tag('group'):attr('row-items', '3')
:tag('data')
:tag('label')
:wikitext('Frakcja')
:done()
:tag('default')
:wikitext('[[File:'..card.frakcja..'|x48px|link='..card.frakcja..']]')
:done()
:done()
:tag('data')
:tag('label')
:wikitext('Siła')
:done()
:tag('default')
:wikitext('[[File:'..card.sila..'|x48px|link=]]')
:done()
:done()
:tag('data')
:tag('label')
:wikitext('Werbunek')
:done()
:tag('default')
:wikitext('[[File:'..card.werbunek..'|x48px|link=]]')
:done()
:done()
:done()
:tag('data')
:tag('label')
:wikitext('Kolor')
:done()
:tag('default')
:wikitext(card.kolor)
:done()
:done()
:tag('data')
:tag('label')
:wikitext('Rzadkość')
:done()
:tag('default')
:wikitext(card.rzadkosc)
:done()
:done()
:tag('data')
:tag('label')
:wikitext('Rodzaj')
:done()
:tag('default')
:wikitext(card.rodzaj)
:done()
:done()
:tag('data')
:tag('label')
:wikitext('Zestaw Kart')
:done()
:tag('default')
:wikitext(card.zestaw)
:done()
:done()
:tag('data')
:tag('label')
:wikitext('Kategorie')
:done()
:tag('default')
:wikitext(p._concat(card.kategorie))
:done()
:done()
:tag('data')
:tag('label')
:wikitext('Powiązane')
:done()
:tag('default')
:wikitext(p._concat(card.powiazane))
:done()
:done()
:tag('data')
:tag('label')
:wikitext('Artysta')
:done()
:tag('default')
:wikitext(card.artysta)
:done()
:done()
:done()
:done()
:done()
:done()
:done()
:tag('group')
:attr('name', 'footer')
:tag('panel')
:tag('section')
:tag('label')
:wikitext('Umiejętność')
:done()
:tag('data')
:tag('default')
:wikitext(card.umiejetnosc)
:done()
:done()
:done()
:tag('section')
:tag('label')
:wikitext('Cytat')
:done()
:tag('data')
:tag('default')
:attr('name', 'quote')
:wikitext(card.cytat)
:done()
:done()
:done()
:done()
:done()
local markup = tostring(infobox)
return mw.getCurrentFrame():preprocess(markup)
end
function p._concat(t)
local out = ''
for i, v in ipairs(t) do
out = out .. v
if t[i + 1] then out = out .. ', ' end
end
return out
end
return p