Module:TerrainCats

local TerrainCategories = {} -- Wikitext lists --local List = require('Dev:List') -- Helper function local ctTrans = require('Module:CTtrans').climateTerrainString

local function makeCategory( inputText ) local output = "" if ctTrans(inputText) ~= "" then output = "" end return output end

function TerrainCategories.TerrainCats( frame ) local output = "" local splitText = mw.text.split(mw.ustring.lower(frame.args[1]), '%s*%p%s*') for _,v in ipairs(splitText) do       if v == "any land" then output = output .. makeCategory('desert') .. makeCategory('forest') .. makeCategory('hills') .. makeCategory('marshes') .. makeCategory('mountains') .. makeCategory('plains') elseif v == "any space" then output = output .. makeCategory('wildspace') .. makeCategory('phlogiston') else output = output .. makeCategory(v) end end return output end

return TerrainCategories