Exemple #1
0
    def populate_lookup_table(self, batch):
        for data in batch:
            if not data.output_name():
                continue

            parent_dir = "/" + os.path.dirname(data.output_name())
            if not self.lookup_table.has_key(parent_dir):
                self.lookup_table[parent_dir] = {'docs' : []}

            if data.is_canonical_output():
                self.lookup_table[parent_dir]['docs'].append(data)

            if data.is_index_page():
                self.lookup_table[parent_dir]['index-page'] = data
Exemple #2
0
    def populate_lookup_table(self, batch):
        for data in batch:
            if not data.output_name():
                continue

            parent_dir = "/" + os.path.dirname(data.output_name())
            if not parent_dir in self.lookup_table:
                self.lookup_table[parent_dir] = {'docs': []}

            if data.is_canonical_output():
                self.lookup_table[parent_dir]['docs'].append(data)

            if data.is_index_page():
                self.lookup_table[parent_dir]['index-page'] = data
Exemple #3
0
    def website_specific_template_environment(self, data, initial_args=None):
        env_data = {}

        if initial_args:
            env_data.update(initial_args)

        current_dir = posixpath.dirname(data.output_name())
        parent_dir = os.path.split(current_dir)[0]

        env_data.update({
                'link' : ("Function to create link to other page.",
                    partial(self.link, data)),
                'section' : ("Function to create link to section on any page.",
                    partial(self.section, data)),
                'navigation' : ("DEPRECATED. 'navigation' object.",
                    {}),
                'nav' : ("The node for the current document's directory.",
                    self._navobj.nodes["/%s" % current_dir]),
                'root' : ("The root node of the navigation tree.",
                    self._navobj.nodes["/"]),
                'navobj' : ("DEPRECATED. Same as 'navtree'.",
                    self._navobj),
                'navtree' : ("The complete navigation tree for the website.",
                    self._navobj),
                'page_title' : ("Title of the current page.",
                    data.title()),
                'title' : ("Title of the current page.",
                    data.title()),
                'parent_dir' : ("The directory one level up from the document being processed.",
                    parent_dir),
                'current_dir' : ("The directory containing the document being processed.",
                    current_dir),
                's' : ("'%s' type data object representing the current doc." % data.alias,
                    data),
                'd' : ("'%s' type data object representing the current doc." % data.alias,
                    data),
                'source' : ("Output name of current doc.",
                    data.output_name()),
                'wrapper' : ("The current wrapper object.",
                    self.wrapper)
                })

        return env_data
Exemple #4
0
    def website_specific_template_environment(self, data, initial_args=None):
        env_data = {}

        if initial_args:
            env_data.update(initial_args)

        current_dir = posixpath.dirname(data.output_name())
        parent_dir = os.path.split(current_dir)[0]

        env_data.update({
            'link': ("Function to create link to other page.",
                     partial(self.link, data)),
            'section': ("Function to create link to section on any page.",
                        partial(self.section, data)),
            'navigation': ("DEPRECATED. 'navigation' object.", {}),
            'nav': ("The node for the current document's directory.",
                    self._navobj.nodes["/%s" % current_dir]),
            'root':
            ("The root node of the navigation tree.", self._navobj.nodes["/"]),
            'navobj': ("DEPRECATED. Same as 'navtree'.", self._navobj),
            'navtree':
            ("The complete navigation tree for the website.", self._navobj),
            'page_title': ("Title of the current page.", data.title()),
            'title': ("Title of the current page.", data.title()),
            'parent_dir':
            ("The directory one level up from the document being processed.",
             parent_dir),
            'current_dir':
            ("The directory containing the document being processed.",
             current_dir),
            's': ("'%s' type data object representing the current doc." %
                  data.alias, data),
            'd': ("'%s' type data object representing the current doc." %
                  data.alias, data),
            'source': ("Output name of current doc.", data.output_name()),
            'wrapper': ("The current wrapper object.", self.wrapper)
        })

        return env_data