跳转到内容

Module:Sandbox list:修订间差异

添加的内容 删除的内容
Lakejason0
Lakejason0留言 | 贡献 (建立内容为“local p = {} function p.main() local f = mw.getCurrentFrame() local dpl = f:preprocess [==[{{#dpl: |titleregexp=沙盒¦Sandbox/ |namespace={{NAMESPACE}}…”的新页面)
 
第13行: 第13行:
|userdateformat=U
|userdateformat=U
}}]==]
}}]==]

local timezone = function()
local now = os.time()
return os.difftime(now, os.time(os.date("!*t", now)))
end


local subst = function(...)
local subst = function(...)
第18行: 第23行:
local prefix, time = ...
local prefix, time = ...
if type(time) == 'string' then
if type(time) == 'string' then
time = os.difftime(os.time(), tonumber(time))
time = os.difftime(timezone() + os.time(), tonumber(time))
return prefix .. mw.getContentLanguage():formatDuration(time, { 'years', 'weeks', 'days', 'hours', 'minutes' }) .. '前'
return prefix .. mw.getContentLanguage():formatDuration(time, { 'years', 'weeks', 'days', 'hours', 'minutes' }) .. '前'
else
else

2021年5月2日 (日) 16:17的版本

此模块没有文档页面。如果你知道如何使用模块,请创建它。
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 timezone = function()
        local now = os.time()
        return os.difftime(now, os.time(os.date("!*t", now)))
    end

	local subst = function(...)
		-- Unix timestamp
		local prefix, time = ...
		if type(time) == 'string' then
			time = os.difftime(timezone() + os.time(), 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
Cookie帮助我们提供我们的服务。通过使用我们的服务,您同意我们使用cookie。