FANDOM


local Infobox = {}
local HF = require("Module:ComicsHF")
-- Since this should only be evaluated once per pageview, it's now global
_G.vars = { Pagename = mw.title.getCurrentTitle().text }
 
----------------------
-- Public functions --
----------------------
 
function Infobox.CategoriesFromKeywords( fieldValue, valid, exceptions, vars )
  local output = ""
 
  -- Field isn't blank
  if fieldValue ~= nil then
 
    -- Grab a valid pair and use it
    for validKey, validValue in pairs(valid) do
 
      -- If you find the validKey in the field, look more closely
      if string.find( string.lower(fieldValue), validKey ) ~= nil then
 
        -- Check if there are exceptions for the validKey
        if type(exceptions[validKey]) ~= "table" then
 
          -- There are no exceptions, just categorize using this validKey and move to the next validKey
          for valueKey, valueCategoryName in ipairs( validValue ) do
 
            output = output .. HF.CategoryLink( valueCategoryName, vars.Pagename, "" )
 
            end
 
          end
      end
    end
  end
  return output
end
 
return Infobox

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.