Module:Updated
Appearance
This module is rated as alpha. It is ready for third-party input, and may be used on a few pages to see if problems arise, but should be watched. Suggestions for new features or changes in their input and output mechanisms are welcome. |
Implements {{Updated}}.
Usage
[edit]{{#invoke:Updated|main|date|refs (optional)}}
local Date = require('Module:Date')._Date
local current = require('Module:Date')._current
local p = {}
function p.main(frame)
local day
if frame.args[1] then
local success, result = pcall(function() return Date(frame.args[1]):text('dmy') end)
if success then
day = result
else
error('Invalid date format in Template:Update.')
end
else
day = Date(current.year, current.month, current.day):text('dmy') + '[[Category:Pages using updated template with missing date]]'
end
--check for extra args
local extra = ''
if frame.args[3] and mw.title.getCurrentTitle() == 0 then
extra = '[[Category:Pages using updated template with unknown parameters]]'
end
return string.format(": ''As of %s%s%s''", day, frame.args[2] or '', extra)
end
return p