模块:读音显示:修订间差异
来自潮语辞书
更多操作
小无编辑摘要 |
小无编辑摘要 |
||
第1行: | 第1行: | ||
local p = {} | local p = {} | ||
local mw = mw | local mw = mw | ||
function p.render(frame) | function p.render(frame) | ||
local char = frame.args[1] or "三" | local char = frame.args[1] or "三" | ||
local regions = { | local regions = { | ||
"三饶", "凤凰", "新丰", "新塘", "汤溪", "浮山", "浮滨", "东山" | |||
} | } | ||
local | local result = {} | ||
for _, region in ipairs(regions) do | for _, region in ipairs(regions) do | ||
table.insert( | local reading = frame:callParserFunction{ | ||
string.format('<li><span class="place">%s</span><span class="pronunciation">%s</span></li>', | name = "#invoke", | ||
region | args = { "字表调用", "getReading", char, region } | ||
} | |||
table.insert(result, | |||
string.format( | |||
'<li><span class="place">%s</span><span class="pronunciation">%s</span></li>', | |||
region, reading or "查无" | |||
) | |||
) | ) | ||
end | end | ||
local | local html = [[ | ||
<div class="entry-section regional-pronunciation-section"> | <div class="entry-section regional-pronunciation-section"> | ||
<h2>各地方音</h2> | <h2>各地方音</h2> | ||
<div class="region-group" | <div class="region-group"> | ||
<ul class="dialect-list"> | <ul class="dialect-list"> | ||
% | %s | ||
</ul> | </ul> | ||
</div> | </div> | ||
</div> | </div>]] | ||
]] | |||
return | return string.format(html, table.concat(result, "\n")) | ||
end | end | ||
return p | return p |
2025年7月9日 (三) 17:49的版本
此模块的文档可以在模块:读音显示/doc创建
local p = {}
local mw = mw
function p.render(frame)
local char = frame.args[1] or "三"
local regions = {
"三饶", "凤凰", "新丰", "新塘", "汤溪", "浮山", "浮滨", "东山"
}
local result = {}
for _, region in ipairs(regions) do
local reading = frame:callParserFunction{
name = "#invoke",
args = { "字表调用", "getReading", char, region }
}
table.insert(result,
string.format(
'<li><span class="place">%s</span><span class="pronunciation">%s</span></li>',
region, reading or "查无"
)
)
end
local html = [[
<div class="entry-section regional-pronunciation-section">
<h2>各地方音</h2>
<div class="region-group">
<ul class="dialect-list">
%s
</ul>
</div>
</div>]]
return string.format(html, table.concat(result, "\n"))
end
return p