모듈:LoR
외관
이 모듈에 대한 설명문서는 모듈:LoR/설명문서에서 만들 수 있습니다
local p = {}
function p.link(frame)
local args = frame:getParent().args
if not args[1] then
args = frame.args
end
local target = args[1] or ""
local display = args[2] or ""
if target == "" then
return ""
end
if display == "" then
display = target
end
-- Clean up whitespace
target = mw.text.trim(target)
display = mw.text.trim(display)
-- Try matching the exact target first
local titleObj = mw.title.new(target)
if titleObj and titleObj.exists then
return "[[:" .. target .. "|" .. display .. "]]"
end
-- Parse suffix
local base = target
if string.match(target, "%(LEAGUEOFLEGENDS%)$") then
base = string.gsub(target, "%s*%(LEAGUEOFLEGENDS%)$", "")
elseif string.match(target, "%(리그오브레전드%)$") then
base = string.gsub(target, "%s*%(리그오브레전드%)$", "")
end
-- 1. Try Champion /LoR(LEAGUEOFLEGENDS)
local lorTitle = base .. "/LoR(LEAGUEOFLEGENDS)"
local t = mw.title.new(lorTitle)
if t and t.exists then
return "[[:" .. lorTitle .. "|" .. display .. "]]"
end
-- Try Champion /LoR 1(LEAGUEOFLEGENDS)
local lor1Title = base .. "/LoR 1(LEAGUEOFLEGENDS)"
t = mw.title.new(lor1Title)
if t and t.exists then
return "[[:" .. lor1Title .. "|" .. display .. "]]"
end
-- 2. Try Follower/Spell (레전드 오브 룬테라)(LEAGUEOFLEGENDS)
local cardTitle = base .. " (레전드 오브 룬테라)(LEAGUEOFLEGENDS)"
t = mw.title.new(cardTitle)
if t and t.exists then
return "[[:" .. cardTitle .. "|" .. display .. "]]"
end
-- Fallback to the original target
return "[[:" .. target .. "|" .. display .. "]]"
end
return p