def group_content(generator, content_type):
 category_filter = generator.settings.get('CATEGORIES_TO_COLLATE', None)
 filtering_active = (type(category_filter) in (list, tuple, set))
 collations = generator.context.get('collations', defaultdict(list))
 for content in generator.context[content_type]:
  category_list = [c.strip() for c in content.category.name.split(',')]
  for category in category_list:
   if (filtering_active and (category not in category_filter)):
    continue
   category = substitute_category_name(category)
   collations[('%s_%s' % (category, content_type))].append(content)
 generator.context['collations'] = collations

def group_content ( generator , content_type ) : category_filter = generator . settings . get ( 'CATEGORIES_TO_COLLATE' , None ) filtering_active = ( type ( category_filter ) in ( list , tuple , set ) ) collations = generator . context . get ( 'collations' , defaultdict ( list ) ) for content in generator . context [ content_type ] : category_list = [ c . strip ( ) for c in content . category . name . split ( ',' ) ] for category in category_list : if ( filtering_active and ( category not in category_filter ) ) : continue category = substitute_category_name ( category ) collations [ ( '%s_%s' % ( category , content_type ) ) ] . append ( content ) generator . context [ 'collations' ] = collations
assembles articles and pages into lists based on each article or pages content .