打开/关闭搜索
搜索
打开/关闭菜单
1
1
148
潮语辞书
导航
首页
最近更改
随机页面
MediaWiki帮助
特殊页面
上传文件
打开/关闭外观设置菜单
notifications
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。
user-interface-preferences
个人工具
创建账号
登录
查看“︁模块:读音显示”︁的源代码
来自潮语辞书
查看
阅读
查看源代码
查看历史
associated-pages
模块
讨论
更多操作
←
模块:读音显示
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
local p = {} local mw = mw local function replace_named_placeholders(tpl, replacements) return (tpl:gsub("%%(%w+)%%", replacements)) end function p.render(frame) local char = frame.args[1] or "三" local display_mode = frame.args[2] or "IPA" -- 可选值:"IPA" 或 "潮拼" local function get_reading(region) return frame:callParserFunction{ name = "#invoke", args = { "字表调用", "getReading", char, region, display_mode } } end local regions = { { name = "三饶", reading = get_reading("三饶") }, { name = "凤凰", reading = get_reading("凤凰") }, { name = "新丰", reading = "查无" }, { name = "新塘", reading = "查无" }, { name = "汤溪", reading = get_reading("汤溪") }, { name = "浮山", reading = "查无" }, { name = "浮滨", reading = "查无" }, { name = "东山", reading = "查无" }, } local list_items = {} for _, region in ipairs(regions) do table.insert(list_items, string.format('<li><span class="place">%s</span><span class="pronunciation">%s</span></li>', region.name, region.reading) ) end local html_template = [[ <div class="entry-section regional-pronunciation-section"> <h2>各地方音</h2> <div class="region-group" style="position:relative;"> <button class="toggle-pronunciation-btn" type="button" data-char="%char%" data-mode="%mode%">切换为 %toggle_text%</button> <div class="shanggu-serif"><big>饶平三饶片</big></div> <ul class="dialect-list"> %region_list% </ul> </div> </div> ]] local replacements = { char = char, mode = display_mode == "IPA" and "chao" or "ipa", toggle_text = display_mode == "IPA" and "潮拼" or "IPA", region_list = table.concat(list_items, "\n") } return mw.text.unstrip(replace_named_placeholders(html_template, replacements)) end return p
该页面使用的模板:
模块:读音显示/doc
(
查看源代码
)
返回
模块:读音显示
。
查看“︁模块:读音显示”︁的源代码
来自潮语辞书