模块:Zhchar:修订间差异
SkyEye FAST(讨论 | 贡献) (//Edit via InPageEdit) |
SkyEye FAST(讨论 | 贡献) (//Edit via InPageEdit) |
||
(未显示同一用户的3个中间版本) | |||
第1行:
local p = {}
p.zhchar = function(
for _, key in ipairs( args ) do▼
key = mw.text.trim( key )▼
if key ~= '+' and key:find( '%+' ) then▼
local combozhchar = {}▼
for comboKey in mw.text.gsplit( key, '%s*%+%s*' ) do▼
table.insert( combozhchar, p.key( comboKey ) )▼
end▼
table.insert( zhchar, table.concat( combozhchar, ' + ' ) )▼
table.insert( zhchar, p.key( key ) )▼
end▼
end▼
local result = table.concat( zhchar )▼
return result▼
end▼
return ''▼
end
else
end
local symbols = mw.loadData( 'Module:Zhchar/Symbols' )▼
if key == '' then
local value = symbols[key] or key
if mw.ustring.match(value, '{{RareChar') then
value = f:preprocess(value)
▲ end
end
|
2024年3月17日 (日) 10:11的最新版本
local p = {}
p.zhchar = function(f)
local args = f
if f == mw.getCurrentFrame() then
args = f:getParent().args
end
local zhchar = {}
for _, key in ipairs(args) do
key = mw.text.trim(key)
if key ~= '+' and key:find('%+') then
local combozhchar = {}
for comboKey in mw.text.gsplit(key, '%s*%+%s*') do
table.insert(combozhchar, p.key(comboKey, f))
end
table.insert(zhchar, table.concat(combozhchar, ' + '))
else
table.insert(zhchar, p.key(key, f))
end
end
return table.concat(zhchar)
end
p.key = function(key, f)
if key == '' then
return ''
end
local symbols = mw.loadData('Module:Zhchar/Symbols')
local value = symbols[key] or key
if mw.ustring.match(value, '{{RareChar') then
value = f:preprocess(value)
end
return value
end
return p