跳转到内容

模块:HookCategories

来自天灾之下:危险连接资料站
wiki>Pppery2025年3月13日 (四) 07:33的版本 (Changed protection settings for "Module:HookCategories": Highly visible page or template ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)))
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)

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

local p = {}
function p.cat(frame)
	local extension = frame.args.extension
	if extension == "" then
		local skin = frame.args.skin
		if skin == "" then
			local titleObj  = mw.title.new("Manual:Hooks/" .. frame.args[1])
			if titleObj.exists then
				if titleObj:getContent():find("removed *= *1.", 1, false) then
					if frame.args.backcompat ~= "" then
						return "[[Category:Extensions using removed hooks (back-compat only)]]"
					end
					return "[[Category:Extensions using removed hooks" .. frame:preprocess("{{#translation:}}") .. "]]"
				elseif titleObj:getContent():find("deprecated *= *1.", 1, false) then
					return "[[Category:Extensions using deprecated hooks" .. frame:preprocess("{{#translation:}}") .. "]]"
				end
			else
				return "[[Category:Extensions using redlinked hooks" .. frame:preprocess("{{#translation:}}") .. "]]"
			end
		else
			local titleObj = mw.title.new("Skin:" .. skin)
			if not titleObj.exists then
				return "[[Category:Extensions using hooks from redlinked sources" .. frame:preprocess("{{#translation:}}") .. "]]"
			end
		end
	else
		local titleObj = mw.title.new("Extension:" .. extension)
		if not titleObj.exists then
			return "[[Category:Extensions using hooks from redlinked sources" .. frame:preprocess("{{#translation:}}") .. "]]"
		end
	end
end
return p