Modèle:RecentArticlesButtons/item
De Nefald
Autres actions
-- Modèle pour un bouton d'article récent (compatible Citizen) local p = {}
function p.item(frame)
local args = frame:getParent().args local pageName = args[1] or "Page inconnue" local lastMod = args[2] or ""
-- Détection de la page active local currentTitle = mw.title.getCurrentTitle().text local isActive = (pageName == currentTitle) and ' active' or
-- Formatage de la date
local formattedDate = ""
if lastMod ~= "" then
formattedDate = string.format(
'%s',
mw.getContentLanguage():formatDate("d/m/Y", lastMod)
)
end
return string.format(
'<a href="/wiki/%s" class="dpl-bouton-article%s">%s%s</a>',
mw.uri.encode(pageName, "PATH"),
isActive,
mw.text.nowiki(pageName),
formattedDate
)
end
return p