Module:Sandbox list:修订间差异
来自存档计划,Project Archive by Lakejason0
添加的内容 删除的内容
Lakejason0(留言 | 贡献) |
Lakejason0(留言 | 贡献) |
||
第13行: | 第13行: | ||
|userdateformat=U |
|userdateformat=U |
||
}}]==] |
}}]==] |
||
local localtime = f:preprocess "{{LOCALTIMESTAMP}}" |
local localtime = f:preprocess "{{#timel:U|{{LOCALTIMESTAMP}}}}" |
||
local subst = function(...) |
local subst = function(...) |
2021年5月15日 (六) 05:37的版本
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