跳转到内容
主菜单
主菜单
移至侧栏
隐藏
导航
首页
最近更改
随机页面
MediaWiki帮助
中医百科
搜索
搜索
登录
个人工具
登录
深色模式
查看“Module:Page name”的源代码
模块
讨论
English
阅读
查看源代码
查看历史
工具
工具
移至侧栏
隐藏
操作
阅读
查看源代码
查看历史
清除缓存
常规
链入页面
相关更改
特殊页面
页面信息
页面值
←
Module:Page name
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您必须确认您的电子邮件地址才能编辑页面。请通过
参数设置
设置并确认您的电子邮件地址。
您可以查看和复制此页面的源代码。
local p = {} local getArgs = require 'Module:Arguments'.getArgs local yesno = require 'Module:yesno' function p.convert(variant, simplified, traditional, taiwan, transfer) -- 0允许繁简转换 -- -1强制简体 -- 1强制繁体 -- 2强制台湾繁体 if not traditional then return simplified elseif variant == 2 then return taiwan or traditional elseif variant == 1 then return traditional elseif variant == -1 then return simplified else -- if variant == 0 if transfer and taiwan then return string.format('-{zh-hans:%s;zh-hant:%s;zh-tw:%s}-', simplified, traditional, taiwan) elseif transfer then return string.format('-{zh-hans:%s;zh-hant:%s}-', simplified, traditional) else return simplified end end end local title local function getConfig(variant) variant = variant or 0 -- 0允许繁简转换 -- -1强制简体 -- 1强制繁体 local t = {} local function convert(simplified, traditional, taiwan, transfer) return p.convert(variant, simplified, traditional, taiwan, transfer) -- 这里只是简化一下p.convert,省略一个参数。 -- 这里的variant是getConfig函数中的,不是p.convert中的。 end t[0] = convert('条目','條目') t.page = convert('页面','頁面') local page = t.page t[1] = convert('讨论页','討論頁') local talk = t[1] t[10] = convert'模板' t[11] = t[10] .. talk t[828] = convert('模块','模組',nil,true) t[829] = t[828] .. talk t[2] = convert('用户页','用戶頁','使用者頁面') t[3] = convert('用户','用戶','使用者',true) .. talk t[4] = convert('项目','專案','計畫',true) .. page t[5] = convert('项目','專案','計劃',true) .. talk t[6] = convert('文件','檔案',nil,true) t[7] = t[6] .. talk t[8] = convert('消息','介面',nil,true) .. page t[9] = convert('消息','介面',nil,true) .. talk t[12] = convert('帮助','幫助') .. page t[13] = convert('帮助','幫助') .. talk t[14] = convert('分类','分類') t[15] = t[14] .. talk t[118] = '草稿' t[119] = t[118] .. talk t[218] = '新草稿' t[219] = '新草稿' .. talk t[460] = convert('活动','活動') t[461] = t[460] .. talk t[-1] = convert('特殊页面','特殊頁面') t.doc = convert('文档','文件',nil,true) return t end p.getConfig = getConfig function p.pageName(title, variant, doc) -- doc : bool 是否检查文档 if type(title)=='string' then title = mw.title.new(title) end title = title or mw.title.getCurrentTitle() variant = variant or 0 local id = title.namespace local t = getConfig(variant) local ret = t[id] or t.page if (id==10 or id==828) and doc and title.subpageText=='doc' then ret = ret .. t.doc end return ret end function p.namespacePageName(namespace, variant) local id = (mw.site.namespaces[namespace] or {}).id local t = getConfig(variant) return t[id] or t.page end function p.main(frame) local args = getArgs(frame) local title = args.title local namespace = args.namespace local variant = args.variant return namespace and p.namespacePageName(tonumber(namespace) or namespace, variant) or p.pageName(title and mw.title.new(title), variant, yesno(args.doc, true) ~= false) end function p.template(frame) return p.main(frame:getParent()) end return p
该页面使用的模板:
Module:Arguments
(
查看源代码
)
Module:Documentation
(
查看源代码
)
Module:Fullurl
(
查看源代码
)
Module:No globals
(
查看源代码
)
Module:Page name
(
查看源代码
)
Module:Page name/doc
(
查看源代码
)
Module:Yesno
(
查看源代码
)
返回
Module:Page name
。
开关有限宽度模式