|
Balises : Contenu remplacé Annulation |
| Ligne 1 : |
Ligne 1 : |
| -- Modèle pour un bouton d'article récent (compatible Citizen) | | <li> |
| local p = {}
| | <span class="ext-recent-articles__button"> |
| | | [[{{{1}}}]] |
| function p.item(frame)
| | </span> |
| local args = frame:getParent().args | | </li> |
| 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(
| |
| '<span class="date">%s</span>',
| |
| 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
| |