欢迎来到奇葩栖息地!欢迎加入Discord服务器:XfrfHCzfbW欢迎加入QQ频道:r01m9y3iz6请先至特殊:参数设置验证邮箱后再进行编辑。特殊:参数设置挑选自己想要使用的小工具!不会编辑?请至这里学习Wikitext语法。

模块:Zhchar:修订间差异

来自奇葩栖息地
添加的内容 删除的内容
(//Edit via InPageEdit)
(//Edit via InPageEdit)
第1行: 第1行:
local p = {}
local p = {}
p.zhchar = function(f)

local args = f
p.zhchar = function(frame)
if f == mw.getCurrentFrame() then
local args = frame
if frame == mw.getCurrentFrame() then
args = f:getParent().args
args = frame:getParent().args
end
end

local zhchar = {}
local zhchar = {}


第14行: 第12行:
local combozhchar = {}
local combozhchar = {}
for comboKey in mw.text.gsplit(key, '%s*%+%s*') do
for comboKey in mw.text.gsplit(key, '%s*%+%s*') do
table.insert(combozhchar, p.key(comboKey))
table.insert(combozhchar, p.key(comboKey, f))
end
end
table.insert(zhchar, table.concat(combozhchar, ' + '))
table.insert(zhchar, table.concat(combozhchar, ' + '))
else
else
table.insert(zhchar, p.key(key))
table.insert(zhchar, p.key(key, f))
end
end
end
end


return mw.text.unstrip(table.concat(zhchar))
return table.concat(zhchar)
end
end


p.key = function(key)
p.key = function(key, f)
if key == '' then
if key == '' then
return ''
return ''
第31行: 第29行:


local symbols = mw.loadData('Module:Zhchar/Symbols')
local symbols = mw.loadData('Module:Zhchar/Symbols')
return mw.text.unstrip(symbols[key] or key)
local value = symbols[key] or key
if mw.ustring.match(value, '{{RareChar') then
value = f:expandTemplate{ title = 'RareChar', args = { value } }
end
return value
end
end



2024年3月17日 (日) 10:08的版本

[创建 | 历史 | 清除缓存]文档页面
此模块没有文档页面。如果你知道此模块的使用方法,请帮助为其创建文档页面。
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:expandTemplate{ title = 'RareChar', args = { value } }
    end
    return value
end

return p