Difference between revisions of "Module:Infobox Task"

From Taskman Wiki
Jump to navigation Jump to search
m
m
 
Line 2: Line 2:
  
 
function p.categorise(frame)
 
function p.categorise(frame)
   local categories = frame:getParent().args[1]
+
   local parent = frame:getParent().args
 +
  local categories = parent[1]
 
   local ret = "[[Category:Tasks]]"
 
   local ret = "[[Category:Tasks]]"
 
   for v in string.gmatch(categories, "([A-Za-z]+)") do
 
   for v in string.gmatch(categories, "([A-Za-z]+)") do
 
     ret = ret .. "[[Category:Tasks in " .. v .. " tier]]"
 
     ret = ret .. "[[Category:Tasks in " .. v .. " tier]]"
 +
    if (v == "Passive") then
 +
      local stars = parent[2]
 +
      ret = ret .. "[[Category:" .. stars .. "-star Passive tasks]]"
 +
    end
 
   end
 
   end
 
   return ret
 
   return ret

Latest revision as of 15:25, 18 May 2020

Documentation for this module may be created at Module:Infobox Task/doc

local p = {};

function p.categorise(frame)
  local parent = frame:getParent().args
  local categories = parent[1]
  local ret = "[[Category:Tasks]]"
  for v in string.gmatch(categories, "([A-Za-z]+)") do
    ret = ret .. "[[Category:Tasks in " .. v .. " tier]]"
    if (v == "Passive") then
      local stars = parent[2]
      ret = ret .. "[[Category:" .. stars .. "-star Passive tasks]]"
    end
  end
  return ret
end

return p