Changes

no edit summary
Line 40: Line 40:  
   -- Filter term ([1] = pattern to match, [2] = data element to match)
 
   -- Filter term ([1] = pattern to match, [2] = data element to match)
 
   local filter = { (args.explicit['filterMatch'] or nil), (args.explicit['filterGroup'] or nil) }
 
   local filter = { (args.explicit['filterMatch'] or nil), (args.explicit['filterGroup'] or nil) }
 +
  local idsList = nil
 +
  if(args.explicit['filterIDs']) then
 +
      idsList = mw.text.split(string.gsub(args.explicit['filterIDs'],'%s+',''), ',', true)
 +
  end
 
   local result = {}
 
   local result = {}
 
   for i, category in ipairs(args.explicit) do
 
   for i, category in ipairs(args.explicit) do
Line 45: Line 49:  
     table.insert(result, _.format(table_header, { category = category }))
 
     table.insert(result, _.format(table_header, { category = category }))
 
     for i, q in ipairs(data) do
 
     for i, q in ipairs(data) do
       if (not filter[1] or not filter[2]) or (string.match(q[filter[2]], filter[1])) then
+
      local proceed = false
 +
       if(idsList == nil) then
 +
        proceed = true
 +
      else
 +
        for j, qid in ipairs(idsList) do
 +
          if(q.label == qid) then
 +
              proceed = true
 +
              table.remove(idsList, j)
 +
              break
 +
          end
 +
        end
 +
      end
 +
      if (proceed or ((not filter[1] or not filter[2]) or (string.match(q[filter[2]], filter[1])))) then
 
         if(q.alias_of) then
 
         if(q.alias_of) then
 
             table.insert(result, _.format(table_row_alias, {
 
             table.insert(result, _.format(table_row_alias, {