模組:VGNL
外观
![]() | 此模块使用Lua语言: |
本模组可生成最新出刊的《电子游戏专题简讯》页面名和标签。
示例
{{#invoke:VGNL|link}}
⇒ 脚本错误:函数“link”不存在。{{#invoke:VGNL|target|upcoming}}
⇒ 脚本错误:函数“target”不存在。{{#invoke:VGNL|date|2024-01}}
⇒ 脚本错误:函数“date”不存在。{{#invoke:VGNL|toc|style=inline}}
⇒ 脚本错误:函数“toc”不存在。{{#invoke:VGNL|toc}}
⇒ (以点列生成上方内容){{#invoke:VGNL|index}}
⇒ (生成简讯的目录表)
目录
資料定義於子模組Module:VGNL/items。
脚本错误:函数“index”不存在。
require('Module:No globals')
local getArgs = require('Module:Arguments').getArgs
local p = {}
local yesno = require('Module:Yesno')
local function tl(title, args)
return mw.getCurrentFrame():expandTemplate{ title = title, args = args }
end
function p.main(frame)
local args = getArgs(frame)
return p._main(args)
end
function p._main(args)
local cur_date = '00000000'
local text = mw.title.makeTitle('WikiProject', '電子遊戲/簡訊/目錄'):getContent()
local published_dates = text:gmatch('data%-sort%-value%s*=%s*"(%d%d%d%d%d%d%d%d)"')
for v in published_dates do
if (v > cur_date) and (v ~= '99999999') then
cur_date = v
end
end
-- RETURN
return 'WikiProject:電子遊戲/簡訊/' .. cur_date:sub(1,4) .. '-' .. cur_date:sub(5,6)
end
return p