Aller au contenu

Module:Dates

De Wikiquestia
Version datée du 24 juin 2025 à 11:01 par Alakihel (discussion | contributions) (Page créée avec « local p = {} function p.afficherDates(frame) local args = frame:getParent().args local res = '' local i = 1 while args['Date importante ' .. i] or args['Date ' .. i] do local titre = args['Date importante ' .. i] or '' local date = args['Date ' .. i] or '' if titre ~= '' or date ~= '' then res = res .. string.format('<tr><td style="padding-right:1em;"><b>%s</b></td><td>%s</td></tr>', titre, date) end i = i + 1 end if res ~= '' then return... »)
(diff) ← Version précédente | Voir la version actuelle (diff) | Version suivante → (diff)

La documentation pour ce module peut être créée à Module:Dates/doc

local p = {}

function p.afficherDates(frame)
	local args = frame:getParent().args
	local res = ''
	local i = 1

	while args['Date importante ' .. i] or args['Date ' .. i] do
		local titre = args['Date importante ' .. i] or ''
		local date = args['Date ' .. i] or ''

		if titre ~= '' or date ~= '' then
			res = res .. string.format('<tr><td style="padding-right:1em;"><b>%s</b></td><td>%s</td></tr>', titre, date)
		end
		i = i + 1
	end

	if res ~= '' then
		return string.format(
			'<div class="soustitre" style="text-align:center; background-color: #ecf6fb; font-weight: bold; padding: 4px 8px; margin-top: 6px;">Dates importantes</div><table class="infobox" style="width:100%%;">%s</table>',
			res
		)
	else
		return ''
	end
end

return p