全站通知:
模块:Expanded/Name
刷
历
编
跳到导航
跳到搜索
local utils = require("Module:Utils")
local utils2 = require("Module:Expanded/Utils")
local name = require("Module:Name")
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 name.getName(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 name.getName(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