Module:Sandbox list
来自存档计划,Project Archive by Lakejason0
local p = {}
function p.main()
local f = mw.getCurrentFrame()
local dpl = f:preprocess [==[{{#dpl:
|titleregexp=沙盒¦Sandbox/
|namespace={{NAMESPACE}}
|noresultsheader=没有子页面
|format=,¶* [[%PAGE%]]<br>最后编辑于:%DATE%:,,
|ordermethod=lastedit
|addeditdate=true
|userdateformat=U
}}]==]
local localtime = f:preprocess "{{#timel:U|{{LOCALTIMESTAMP}}}}"
local subst = function(...)
-- Unix timestamp
local prefix, time = ...
if type(time) == 'string' then
time = os.difftime(tonumber(localtime), tonumber(time))
return prefix .. mw.getContentLanguage():formatDuration(time, { 'years', 'weeks', 'days', 'hours', 'minutes' }) .. '前'
else
return prefix .. time
end
end
local result = dpl:gsub('(最后编辑于):(%d+):', subst)
return result
end
return p