Module:New pages: Difference between revisions
From Eli's Software Encyclopedia
mNo edit summary Tag: Manual revert |
mNo edit summary |
||
| Line 3: | Line 3: | ||
function p.main() | function p.main() | ||
local data = mw. | local data = mw.smw.ask { | ||
'[[:+]][[Creation date::+]]', | |||
'mainlabel=-', | |||
'?Creation date#-F[Y-m-dTH:i:s]=timestamp', | |||
'?#-=title', | |||
'?Page creator#-=user', | |||
'sort=Creation date', | |||
'order=desc', | |||
'limit=20' | |||
} or {} | } or {} | ||
Revision as of 11:42, December 10, 2025
Documentation for this module may be created at Module:New pages/doc
local p = {}
function p.main()
local data = mw.smw.ask {
'[[:+]][[Creation date::+]]',
'mainlabel=-',
'?Creation date#-F[Y-m-dTH:i:s]=timestamp',
'?#-=title',
'?Page creator#-=user',
'sort=Creation date',
'order=desc',
'limit=20'
} or {}
local rtitle, rdate, ruser, rrow
local html = mw.html.create()
local ul = html:tag('ul')
for _, page in ipairs(data) do
rtitle = page.title
rdate = page.timestamp
ruser = page.user
local year, month, day, hour, minute, second = rdate:match("^(%d+)-(%d+)-(%d+)T(%d+):(%d+):(%d+)")
if year and month and day and hour and minute then
rdate = string.format('%s-%s-%s %s:%s', year, month, day, hour, minute)
else
rdate = 'Invalid Timestamp' -- Handle invalid timestamps
end
rrow = string.format('%s - [[%s]] by [[User:%s|%s]]', rdate, rtitle, ruser, ruser )
ul:tag('li'):wikitext(rrow)
end
return html
end
return p
