模块:GetPageCode

来自维阿百科
跳转至: 导航搜索

此模块的文档可以在模块: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