+ if not node.references:
+ if node.name not in contentlet_specs:
+ contentlet_specs.append(node.name)
+ else:
+ if node.name not in contentreference_names:
+ contentreference_specs.append((node.name, node.references))
+ contentreference_names.add(node.name)
+ if isinstance(node, ExtendsNode) and block_context is not None:
+ block_context.add_blocks(node.blocks)
+ parent = getattr(node, LOADED_TEMPLATE_ATTR)
+ for node in parent.nodelist:
+ if not isinstance(node, TextNode):
+ if not isinstance(node, ExtendsNode):
+ blocks = dict([(n.name, n) for n in parent.nodelist.get_nodes_by_type(BlockNode)])
+ block_context.add_blocks(blocks)
+ break
+
+ if hasattr(node, 'child_nodelists') and not isinstance(node, BlockNode):
+ for nodelist_name in node.child_nodelists:
+ if hasattr(node, nodelist_name):
+ nodelist_crawl(getattr(node, nodelist_name), process_node, contentlet_specs, contentreference_specs, contentreference_names, block_context)
+
+ # LOADED_TEMPLATE_ATTR contains the name of an attribute philo uses to declare a
+ # node as rendering an additional template. Philo monkeypatches the attribute onto
+ # the relevant default nodes and declares it on any native nodes.
+ if hasattr(node, LOADED_TEMPLATE_ATTR):
+ loaded_template = getattr(node, LOADED_TEMPLATE_ATTR)
+ if loaded_template:
+ nodelist_crawl(loaded_template.nodelist, process_node, contentlet_specs, contentreference_specs, contentreference_names, block_context)