Mudanças entre as edições de "Módulo:Changelog"
Ir para navegação
Ir para pesquisar
m |
m |
||
| Linha 3: | Linha 3: | ||
local function N(s) return s and mw.text.trim(tostring(s)) or '' end | local function N(s) return s and mw.text.trim(tostring(s)) or '' end | ||
local function has(s) return N(s) ~= '' end | local function has(s) return N(s) ~= '' end | ||
function p.item(frame) | function p.item(frame) | ||
local parent = frame:getParent() | local parent = frame:getParent() | ||
local | local a = parent and parent.args or frame.args | ||
local title = | local title = N(a.title) | ||
local link = | local link = N(a.link) | ||
local date = | local date = N(a.date) | ||
local desc = | local desc = N(a.description) | ||
local icon = | local icon = N(a.icon) | ||
local color = | local color = N(a.color) | ||
local item = mw.html.create('div'):addClass('notice-item') | local item = mw.html.create('div'):addClass('notice-item') | ||
| Linha 28: | Linha 27: | ||
if has(title) then | if has(title) then | ||
local | local holder = content:tag('span'):addClass('notice-title') | ||
:css('display','block'):css('margin','0') | |||
if has(link) then | |||
holder:wikitext('[' .. link .. ' ' .. title .. ']') -- wikitexto -> <a> | |||
else | |||
holder:wikitext(title) | |||
end | |||
end | end | ||
| Linha 48: | Linha 49: | ||
if has(icon) then | if has(icon) then | ||
item:tag('img'):addClass('notice-icon'):attr('src', icon):attr('alt', title | item:tag('img'):addClass('notice-icon') | ||
:attr('src', icon):attr('alt', title) | |||
:css('object-fit','contain'):css('flex-shrink','0') | :css('object-fit','contain'):css('flex-shrink','0') | ||
end | end | ||
-- | return tostring(item) -- já sai como HTML + wikitexto parseável | ||
end | end | ||
return p | return p | ||
Edição das 19h40min de 2 de setembro de 2025
A documentação para este módulo pode ser criada em Módulo:Changelog/doc
local p = {}
local function N(s) return s and mw.text.trim(tostring(s)) or '' end
local function has(s) return N(s) ~= '' end
function p.item(frame)
local parent = frame:getParent()
local a = parent and parent.args or frame.args
local title = N(a.title)
local link = N(a.link)
local date = N(a.date)
local desc = N(a.description)
local icon = N(a.icon)
local color = N(a.color)
local item = mw.html.create('div'):addClass('notice-item')
:css('display','flex'):css('align-items','flex-start')
:css('background','#fff'):css('border','1px solid #ddd')
:css('border-radius','6px'):css('margin-bottom','10px')
:css('padding','8px 10px'):css('box-sizing','border-box')
:css('border-left','5px solid var(--notice-color, #f5b700)')
if has(color) then item:css('--notice-color', color) end
local content = item:tag('div'):addClass('notice-content'):css('flex','1')
if has(title) then
local holder = content:tag('span'):addClass('notice-title')
:css('display','block'):css('margin','0')
if has(link) then
holder:wikitext('[' .. link .. ' ' .. title .. ']') -- wikitexto -> <a>
else
holder:wikitext(title)
end
end
if has(date) then
content:tag('div'):addClass('notice-date')
:css('font-size','0.9em'):css('color','#888'):css('margin','-5px 0')
:wikitext(date)
end
if has(desc) then
content:tag('p'):addClass('notice-desc')
:css('color','#555'):css('line-height','1.3'):css('margin','0')
:wikitext(desc)
end
if has(icon) then
item:tag('img'):addClass('notice-icon')
:attr('src', icon):attr('alt', title)
:css('object-fit','contain'):css('flex-shrink','0')
end
return tostring(item) -- já sai como HTML + wikitexto parseável
end
return p