跳转到内容
主菜单
主菜单
移至侧栏
隐藏
导航
首页
最近更改
随机页面
MediaWiki帮助
搜索
搜索
创建账号
登录
个人工具
创建账号
登录
查看“模块:MTR”的源代码
模块
讨论
English
阅读
查看源代码
查看历史
工具
工具
移至侧栏
隐藏
操作
阅读
查看源代码
查看历史
常规
链入页面
相关更改
特殊页面
页面信息
←
模块:MTR
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
-- This module implements {{HK-MTR icon}} and {{HK-MTR color}}. local getArgs = require('Module:Arguments').getArgs local data = mw.loadData('Module:MTR/data') local p = {} local function makeInvokeFunction(funcName) -- makes a function that can be returned from #invoke, using -- [[Module:Arguments]]. return function (frame) local args = getArgs(frame, {parentOnly = true}) return p[funcName](args) end end local function getColor(code) return data.colors[code] or '000' end p.colorbyname = makeInvokeFunction('_colorbyname') function p._colorbyname(args) local code = args[1] or '' code = code:upper() return getColor(code) end p.icon = makeInvokeFunction('_icon') function p._icon(args) -- Retrieve arguments local code = args[1] or '' local link = args[2] or args.link local text = args[3] or args.text -- Fetch data from the data module code = code:upper() -- Convert to upper case local name = data.names[code] if not name then -- If we didn't find a name corresponding to the code, exit with a wikitext error. return '<strong class="error">Error: "' .. tostring(code) .. '" is not a valid code.</strong>' end local color = getColor(code) -- Format the link name link = link or name if data.needs_dab[link] then link = '香港' .. link -- 後備迴避歧義用參數,儘管在中文維基百科用不上,如有必要請到模塊:MTR/data修改。 end -- Format the text text = text or name .. '轉車站' -- Build the link return '[[' .. link .. '|<span title="' .. text .. '" style="color:#' .. color .. ';font-size:120%">█</span>]]' end return p
该页面使用的模板:
模块:MTR/doc
(
查看源代码
)
返回
模块:MTR
。
开关有限宽度模式