“模块:GetPageCode”的版本间的差异

来自维阿百科
跳转至: 导航搜索
1.38>牛腩面
(导入1个版本)
 
(导入1个版本)
 
(没有差异)

2022年7月8日 (五) 21:15的最新版本

此模块的文档可以在模块:GetPageCode/doc创建

return function(name)
	local code = mw.title.new(name):getContent()
	local redirect = false
	if code == nil then return nil end
	if string.find(code, '^#REDIRECT%s+%[%[.+%]%]%s*$') or string.find(code, '^#重定向%s+%[%[.+%]%]%s*$') then
		redirect = string.gsub(code, '.+%[%[(.+)%]%]%s*$', '%1')
		code = mw.title.new(redirect):getContent()
	end
	return code, redirect
end