打开/关闭菜单
331
1.7K
131
11.8K
星露谷物语扩展百科
打开/关闭外观设置菜单
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。

模块:Name:修订间差异

来自星露谷物语扩展百科
Sizau留言 | 贡献
无编辑摘要
Sizau留言 | 贡献
无编辑摘要
 
(未显示2个用户的10个中间版本)
第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 items = require("Module:Items")


local overrides = utils.lazyload("Module:Name/data/overrides", true)
local expanded = utils.lazyload("Module:Name/data", true)
local vanilla = utils.lazyload("Module:Name/data/en", true)
local expanded2 = utils.lazyload("Module:Name/data", false)
local expanded = utils.lazyload("Module:Expanded/Name/data", true)
local expanded2 = utils.lazyload("Module:Expanded/Name/data", false)


local p = {}
local p = {}
第21行: 第20行:
     return utils2._link(expanded[text])
     return utils2._link(expanded[text])
     end
     end
 
local tmp = items.getChineseName(text) or text
    return overrides[text] or vanilla[text] or ""
if tmp == "" then
tmp = text
end
if tmp:find("|", 1, true) then
    return "s:" .. tmp
else
    return "s:" .. tmp .. "|" .. tmp
end
end
end


第31行: 第37行:
     end
     end
     text = text:lower():gsub("_"," ")
     text = text:lower():gsub("_"," ")
     return expanded[text] or overrides[text] or vanilla[text] or ""
     return expanded[text] or items.getChineseName(text) or ""
end
end



2026年1月23日 (五) 21:38的最新版本

[ 创建 | 刷新 ]文档页面
当前模块文档缺失,需要扩充。
local utils = require("Module:Utils")
local utils2 = require("Module:Expanded/Utils")
local items = require("Module:Items")

local expanded = utils.lazyload("Module:Name/data", true)
local expanded2 = utils.lazyload("Module: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
	local tmp = items.getChineseName(text) or text
	if tmp == "" then
		tmp = text
	end
	if tmp:find("|", 1, true) then
	    return "s:" .. tmp
	else
	    return "s:" .. tmp .. "|" .. tmp
	end
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