全站通知:
模块:Grangeptsrow
刷
历
编
跳到导航
跳到搜索
local cache = require "mw.ext.LuaCache"
local KEY_PREFIX = "Module:Grangeptsrow"
local EXP_TIME = 172800
local p = {}
local function expandTemplate(args)
local templateArgs = {}
for key, value in pairs(args) do
if value ~= "" then
templateArgs[key] = value
end
end
return mw.getCurrentFrame():expandTemplate{
title = 'Grangeptsrow/Base',
args = {
templateArgs[1],
templateArgs[2],
templateArgs[3],
templateArgs[4],
qualities = templateArgs['qualities'],
item = templateArgs['item'],
}
}
end
function p.render(frame)
local args = frame.args
local cacheKey = KEY_PREFIX .. "|" .. args[1] .. "|" .. args[2] .. "|" .. args[3] .. "|" .. args[4] .. "|" .. (args['qualities'] or "") .. "|" .. (args['item'] or "")
if cache.get(cacheKey) then
local result = cache.get(cacheKey)
return result
end
local result = expandTemplate(args)
cache.set(cacheKey, result, EXP_TIME)
return result
end
function p.expand(frame)
-- local text = frame.args[1] or ''
local cacheKey = '展览会缓存'
if cache.get(cacheKey) then
local result = cache.get(cacheKey)
return result
end
local text = mw.title.new("星露谷展览会/类别分"):getContent()
local expanded = frame:preprocess(text)
cache.set(cacheKey, expanded, EXP_TIME)
return expanded
end
return p