打开/关闭搜索
搜索
打开/关闭菜单
2
1
189
潮语辞书
导航
首页
最近更改
随机页面
MediaWiki帮助
特殊页面
上传文件
打开/关闭外观设置菜单
notifications
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。
user-interface-preferences
个人工具
创建账号
登录
查看“︁模块:字表调用”︁的源代码
来自潮语辞书
查看
阅读
查看源代码
查看历史
associated-pages
模块
讨论
更多操作
←
模块:字表调用
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
local p = {} local mw = mw -- 地区名到模块路径的映射表 local region_map = { -- 省略,保持你原来的完整表格…… } -- 返回带标记的错误,方便后续模块分类处理 local function makeError(msg, region, char) return string.format('<span class="error" data-region="%s" data-char="%s">%s</span>', region or "", char or "", msg) end function p.getReading(frame) local char = frame.args[1] local region = frame.args[2] local mode = frame.args[3] or "潮拼" if not char or char == "" then return makeError("缺少字", region, char) end if not region or region == "" then return makeError("缺少地区", region, char) end local module_path = region_map[region] if not module_path then return makeError("查无此地区数据", region, char) end local ok, mod = pcall(require, "Module:调查字表/" .. module_path) if not ok or not mod or not mod.data then return makeError("查无此地区数据", region, char) end local readings = mod.data[char] if not readings then return makeError("查无“" .. char .. "”在" .. region .. "的读音", region, char) end local result = {} for _, entry in ipairs(readings) do local s = entry[mode] or "—" local zt = entry["字态"] or "" local note = entry["注释"] or "" local gray = entry["灰色"] if gray then s = '<span style="color:gray">' .. s .. '</span>' end if zt ~= "" then s = s .. ' <span style="color:#fff;">[' .. zt .. ']</span>' end if note ~= "" then s = s .. ' <sub>' .. mw.text.nowiki(note) .. '</sub>' end table.insert(result, '<div>' .. s .. '</div>') end return table.concat(result, "\n") end return p
该页面使用的模板:
模块:字表调用/doc
(
查看源代码
)
返回
模块:字表调用
。
查看“︁模块:字表调用”︁的源代码
来自潮语辞书