打开/关闭搜索
搜索
打开/关闭菜单
1.4K
10.6K
86
30.5K
Cookie☆Wiki
导航
首页
alt-z
最近更改
alt-r
随机页面
alt-x
帮助
沙盒
特殊页面
alt-q
上传文件
alt-u
常用
曲奇简介
用语列表
人物一览
曲奇团体
曲奇年表
本篇列表
榜单列表
专辑列表
创作
音MAD
曲奇静画
曲奇实况
曲奇素材
BB剧场
漫画
同人游戏
曲奇实况
与曲奇有交集的内容
淫梦
东方Project
漫画日本昔话
biim兄贵致敬
QVC福岛
哲♂学
创价
YouTuber
恒心教
VOCALOID
运营批判
友情链接
Cookie☆贴吧
真夏夜的银梦贴吧
中文音MAD维基
潮学维基
银饼视频搜索站
中文曲奇维基Fandom站[已弃用]
通知
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。
user-interface-preferences
个人工具
创建账号
登录
alt-o
查看“︁模块:Cat”︁的源代码
来自Cookie☆Wiki
查看
阅读
查看源代码
查看历史
associated-pages
模块
讨论
更多操作
←
模块:Cat
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
local p = {} local yesno = require 'Module:Yesno' local data = require 'Module:Cat/data' local function matchPatternsInList(list, str) for _, pattern in ipairs(list) do if string.find(str, pattern) then return true end end return false end local function shouldBeSupressed(rules, title) -- 根据命名空间筛选是否添加分类 -- ns_mode 是名字空间判定的模式, 可以是 blacklist 或 whitelist, 默认为 blacklist if not rules.ns_mode or rules.ns_mode == 'blacklist' then -- nsid_blacklist: {number-> bool?}, 键是名字空间的 id, 值是是否在黑名单内, 缺省为不在 if rules.nsid_blacklist and rules.nsid_blacklist[title.namespace] then return true end elseif rules.ns_mode == 'whitelist' then -- nsid_whitelist: {number-> bool?}, 规则同 nsid_blacklist if not rules.nsid_whitelist or not rules.nsid_whitelist[title.namespace] then return true end else error('bad ns_mode') end -- 根据条目标题模式筛选是否添加分类 -- title_mode 是条目标题判定的模式, 规则同 ns_mode if not rules.title_mode or rules.title_mode == 'blacklist' then -- title_blacklist: [pattern], 存放了一组 pattern 用于匹配 if rules.title_blacklist and matchPatternsInList(rules.title_blacklist, title.text) then return true end elseif rules.title_mode == 'whitelist' then if not rules.title_whitelist or not matchPatternsInList(rules.title_whitelist, title.text) then return true end else error('bad title_mode') end return false end function p.main() local frame = mw.getCurrentFrame():getParent() -- 如果 nocat 参数为真, 直接不会分类 -- 如果 nocat 参数为假, 无论如何都会分类 local nocat = yesno(frame.args.nocat, nil) if nocat then return nil elseif nocat == false then return frame.args[1] end local title = mw.title.getCurrentTitle() if shouldBeSupressed(data.rulesMap['*'], title) then return nil end local kind = frame.args[2] or frame.args['kind'] or 'unspecified' local rules = data.rulesMap[kind] or data.rulesMap['unspecified'] if rules and shouldBeSupressed(rules, title) then return nil end return frame.args[1] end return p
该页面使用的模板:
模块:Cat/doc
(
查看源代码
)
返回
模块:Cat
。