Mudanças entre as edições de "Módulo:WeeklyBosses"
Ir para navegação
Ir para pesquisar
m |
m |
||
| Linha 1: | Linha 1: | ||
local p = {} | local p = {} | ||
function p.main(frame) | function p.main(frame) | ||
local args = frame:getParent().args or {} | local args = frame:getParent().args or {} | ||
local | local out = {} | ||
for i = 1, 10 do | for i = 1, 10 do | ||
| Linha 17: | Linha 12: | ||
local img = mw.text.trim(args['imgbtn' .. i] or '') | local img = mw.text.trim(args['imgbtn' .. i] or '') | ||
local bg = mw.text.trim(args['bg' .. i] or args['background'] or '#2a3544') | local bg = mw.text.trim(args['bg' .. i] or args['background'] or '#2a3544') | ||
local nome = (txt ~= '' and txt or link) | |||
-- Wikitext: [[página|conteúdo do link]]. Conteúdo = imagem (se tiver) + nome | |||
local display | |||
local | |||
if img ~= '' then | if img ~= '' then | ||
display = '[[Arquivo:' .. img .. '|48px]]<br/>' .. nome | |||
else | |||
display = nome | |||
end | end | ||
local linkWikitext = '[[' .. link .. '|' .. display .. ']]' | |||
-- Só as divs são HTML (para o CSS); o conteúdo é wikitext para o parser interpretar | |||
table.insert(out, '<div class="weekly-bosses__btn" data-background="' .. bg .. '">' .. linkWikitext .. '</div>') | |||
end | end | ||
return | return '<div class="weekly-bosses">' .. table.concat(out) .. '</div>' | ||
end | end | ||
return p | return p | ||
Edição das 03h51min de 22 de fevereiro de 2026
A documentação para este módulo pode ser criada em Módulo:WeeklyBosses/doc
local p = {}
function p.main(frame)
local args = frame:getParent().args or {}
local out = {}
for i = 1, 10 do
local link = mw.text.trim(args['linkbtn' .. i] or '')
if link == '' then break end
local txt = mw.text.trim(args['txtbtn' .. i] or '')
local img = mw.text.trim(args['imgbtn' .. i] or '')
local bg = mw.text.trim(args['bg' .. i] or args['background'] or '#2a3544')
local nome = (txt ~= '' and txt or link)
-- Wikitext: [[página|conteúdo do link]]. Conteúdo = imagem (se tiver) + nome
local display
if img ~= '' then
display = '[[Arquivo:' .. img .. '|48px]]<br/>' .. nome
else
display = nome
end
local linkWikitext = '[[' .. link .. '|' .. display .. ']]'
-- Só as divs são HTML (para o CSS); o conteúdo é wikitext para o parser interpretar
table.insert(out, '<div class="weekly-bosses__btn" data-background="' .. bg .. '">' .. linkWikitext .. '</div>')
end
return '<div class="weekly-bosses">' .. table.concat(out) .. '</div>'
end
return p