FANDOM


local A = { }
 
local HF = require("Module:HF")
local parent = nil
 
local build = function(arg, arg2, category)
  local built = ""
 
  local link = ""
  local text = ""
 
  if not HF.isempty(arg) then
 
    link = arg
 
    if not HF.isempty(arg2) then
      text = arg2
    else
      link = string.match(arg, "([^%[%|%]]+)")
      text = string.match(arg, "%|([^%]%|]+)")
    end
 
    if string.find(link, "w:c:") == nil and string.find(link, "Glossary:") == nil and string.find(link, "#") == nil then
      if not HF.isempty(link) and not HF.isempty(text) then
          built = "[[" .. link .. "|" .. text .. "]][[Category:" .. link .. category .. "]]"
      elseif not HF.isempty(link) and HF.isempty(text) then
          built = "[[" .. link ..  "]][[Category:" .. link .. category .. "]]"
      else
          built = arg
      end
    else
      built = arg
    end
  end
 
  return built
 
end
 
function A.appearances(frame)
  parent = frame:getParent()
  local arg = parent.args[1]
  local arg2 = parent.args[2]
  local arg3 = parent.args[3]
  local category = "/Appearances"
  local output = ""
 
  if HF.isempty(arg3) then
    output = build(arg, arg2, category)
  else
    output = build(arg, arg2, category) .. " <span style=\"color:darkgreen\"><small>\'\'\'\'\'(" .. arg3 .. ")\'\'\'\'\'</small></span>"
  end
 
  return output
end
 
function A.apn(frame)
  parent = frame:getParent()
  local arg = parent.args[1]
  local arg2 = nil
  local category = "/Appearances"
  local output = ""
    output = build(arg, arg2, category)
  return output
end
 
function A.mentions(frame)
  parent = frame:getParent()
  local arg = parent.args[1]
  local arg2 = parent.args[2]
  local arg3 = parent.args[3]
  local category = "/Mentions"
  local output = ""
 
  if HF.isempty(arg3) then
    output = build(arg, arg2, category) .. " <span style=\"color:darkgreen\"><small>\'\'\'\'\'(Mentioned)\'\'\'\'\'</small></span>"
  else
    output = build(arg, arg2, category) .. " <span style=\"color:darkgreen\"><small>\'\'\'\'\'(" .. arg3 .. ")\'\'\'\'\'</small></span>"
    end
 
  return output
end
 
 
return A

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.