模块:Name:修订间差异
来自星露谷物语扩展百科
更多操作
无编辑摘要 |
无编辑摘要 |
||
| 第1行: | 第1行: | ||
local utils = require("Module:Utils") | local utils = require("Module:Utils") | ||
local utils2 = require("Module:Expanded/Utils") | local utils2 = require("Module:Expanded/Utils") | ||
local | local items = require("Module:Items") | ||
local expanded = utils.lazyload("Module:Expanded/Name/data", true) | local expanded = utils.lazyload("Module:Expanded/Name/data", true) | ||
| 第21行: | 第21行: | ||
end | end | ||
return | return items.getChineseName(text) or "" | ||
end | end | ||
| 第30行: | 第30行: | ||
end | end | ||
text = text:lower():gsub("_"," ") | text = text:lower():gsub("_"," ") | ||
return expanded[text] or | return expanded[text] or items.getChineseName(text) or "" | ||
end | end | ||
2025年10月15日 (三) 01:25的版本
local utils = require("Module:Utils")
local utils2 = require("Module:Expanded/Utils")
local items = require("Module:Items")
local expanded = utils.lazyload("Module:Expanded/Name/data", true)
local expanded2 = utils.lazyload("Module:Expanded/Name/data", false)
local p = {}
function p.getName(input)
local text = utils.getArg(input)
if not text then
return ""
end
if p.getDefaultName(text) ~= '' then
return utils2._link(text)
end
text = text:lower():gsub("_"," ")
if expanded[text] ~= nil then
return utils2._link(expanded[text])
end
return items.getChineseName(text) or ""
end
function p.getRawName(input)
local text = utils.getArg(input)
if not text then
return ""
end
text = text:lower():gsub("_"," ")
return expanded[text] or items.getChineseName(text) or ""
end
-- =p.getDefaultName { args = { "大叫汉堡" } }
function p.getDefaultName(input)
local text = utils.getArg(input)
if not text then
return ""
end
for key, value in pairs(expanded2) do
if string.lower(value) == text then
return key
end
end
return ""
end
return p