FANDOM


-- If page is in TV space, english link will be redirected to got wiki.
local p = {}
local awoiaf = "http://awoiaf.westeros.org/index.php/"
local gotwiki = "http://gameofthrones.wikia.com/wiki/"
local noLang = false
 
local function genEn(frame)
  local enPage = frame.args[1]
  if enPage ~= nil then
    enPage = enPage:gsub(" ", "_")
  else
    enPage = ""
  end
  local display = frame.args[2]
  if display ~= nil and display ~= "" then
    display = display:gsub("_", " ")
  else
    display = enPage:gsub("_", " ")
  end
  local title = mw.title.getCurrentTitle()
  local res = ""
  if title:inNamespace("TV") then
    res = "(\'\'\'[" .. gotwiki .. enPage .. " " .. display .. "]\'\'\')"
  else
    res = "(\'\'\'[" .. awoiaf .. enPage .. " " .. display .. "]\'\'\')"
  end
  if noLang ~= true then
    res = res .. "[[en:" .. enPage:gsub("_", " ") .. "]]"
  end
  return res
end
 
function p.en(frame)
  return genEn(frame)
end
 
function p.enNoLang(frame)
  noLang = true
  return genEn(frame)
end
 
return p
除了特别提示,社区内容遵循CC-BY-SA 授权许可。