Módulo:PetOutfitsVisualizer: mudanças entre as edições
Ir para navegação
Ir para pesquisar
Sem resumo de edição |
Sem resumo de edição |
||
| Linha 8: | Linha 8: | ||
display = 'flex', | display = 'flex', | ||
flexWrap = 'wrap', | flexWrap = 'wrap', | ||
gap = ' | gap = '10px' | ||
}) | }) | ||
| Linha 14: | Linha 14: | ||
local file, caption = outfitPair:match("^%s*(.-)%s*,%s*(.-)%s*$") | local file, caption = outfitPair:match("^%s*(.-)%s*,%s*(.-)%s*$") | ||
if file then | if file then | ||
local | local box = mw.html.create('div') | ||
:css({textAlign = 'center'}) | :addClass('gallerybox') | ||
:wikitext(string.format('[[File:%s| | |||
container:node( | -- Imagem | ||
local imgDiv = mw.html.create('div') | |||
:css({ textAlign = 'center' }) | |||
:wikitext(string.format('[[File:%s|72px]]', file)) | |||
box:node(imgDiv) | |||
-- Texto/legenda | |||
local textDiv = mw.html.create('div') | |||
:addClass('gallerytext') | |||
:css({ textAlign = 'center', marginTop = '4px' }) | |||
:wikitext(caption or "") | |||
box:node(textDiv) | |||
container:node(box) | |||
end | end | ||
end | end | ||
Edição das 19h17min de 16 de agosto de 2025
A documentação para este módulo pode ser criada em Módulo:PetOutfitsVisualizer/doc
local p = {}
function p.render(frame)
local outfitsStr = frame.args.outfits or ""
local container = mw.html.create('div')
:addClass('pet-outfit-gallery')
:css({
display = 'flex',
flexWrap = 'wrap',
gap = '10px'
})
for outfitPair in outfitsStr:gmatch("[^;]+") do
local file, caption = outfitPair:match("^%s*(.-)%s*,%s*(.-)%s*$")
if file then
local box = mw.html.create('div')
:addClass('gallerybox')
-- Imagem
local imgDiv = mw.html.create('div')
:css({ textAlign = 'center' })
:wikitext(string.format('[[File:%s|72px]]', file))
box:node(imgDiv)
-- Texto/legenda
local textDiv = mw.html.create('div')
:addClass('gallerytext')
:css({ textAlign = 'center', marginTop = '4px' })
:wikitext(caption or "")
box:node(textDiv)
container:node(box)
end
end
return tostring(container)
end
return p