Module:HookCategories

Module documentation
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