from os import path

from stayput import scanners

class Site(object):

    def __init__(self, root_path, scanner=scanners.filesystem_scanner):
        self.root_path = root_path
        self.items_path = path.join(root_path, 'items/')
        self.templates_path = path.join(root_path, 'templates/')
        self.output_path = path.join(root_path, 'output/')

        self.scanner = scanner
        self.items = {}
        self.templater = None
        self.router = None

    def scan(self):
        for item in self.scanner(self):
            self.items[item.path] = item

    def template_item(self, item):
        templater = self.templater
        if item.templater:
            templater = item.templater
        return templater.template(item)

    def route_item(self, item):
        return self.router(item, site=self)


class Node(object):

    def __init__(self, path=None, content_provider=None, templater=None):
        """
        :param path: The path to this node relative to the site
        :param content_provider: A function that when called returns the contents for the node
        :param templater: A local templater to be used for this node
        """
        self.path = path
        self.content_provider = content_provider
        self.templater = templater
        self._cached_contents = None

    @property
    def contents(self):
        if not self.content_provider:
            raise NotImplementedError("This node does not have a content provider.")

        if not self._cached_contents:
            self._cached_contents = self.content_provider()

        return self._cached_contents

@@ -134,16 +134,45 @@
 _scanner
+, router=None, templater=None
 ):%0A     
@@ -463,20 +463,25 @@
 later = 
-None
+templater
 %0A       
@@ -495,20 +495,22 @@
 outer = 
-None
+router
 %0A%0A    de

Add router and templater to site constructor