How to use the nikola.utils.apply_filters function in Nikola

To help you get started, we’ve selected a few Nikola examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github undertherain / pycontextfree / site / plugins / copy_pics / copy_pics.py View on Github external
def gen_tasks(self):
        for in_name in get_entries(os.path.join(base_path, "../examples")):
            name_image = os.path.basename(in_name)
            out_name = "output/gallery/" + name_image

        # in_name = "/home/blackbird/Projects_heavy/pycontextfree/examples/paper/paper.png"
        # out_name = "output/gallery/paper.png"
        # out_name = "gallery/paper.png"
            LOGGER.info(f"emiting copyi task {in_name} to {out_name}")
            yield utils.apply_filters({
                'basename': self.name,
                'name': out_name,
                'file_dep': [in_name],
                'targets': [out_name],
                'actions': [(utils.copy_file, [in_name, out_name])],
                'clean': True,
                }, {})
github openframeworks / ofSite / plugins / documentation / documentation / __init__.py View on Github external
index_block_template_dep = self.site.template_system.template_deps(index_block_template_name)
        module_intro_template_name = "documentation_module_intro.mako"
        module_intro_template_dep = self.site.template_system.template_deps(module_intro_template_name)
        tdst = []
        for lang in self.kw['translations']:
            short_tdst = os.path.join(self.kw['translations'][lang], "documentation", "index.html")
            tdst.append(os.path.normpath(os.path.join(self.kw['output_folder'], short_tdst)))

        docs_md = []
        directory = os.path.join(self.site.original_cwd, "documentation")
        for root, subFolders, files in os.walk(directory):
            for file in files:
                f = os.path.join(root,file)
                docs_md.append(f)

        yield utils.apply_filters({
            'basename': self.name,
            'name': "documentation",
            'file_dep': template_dep + docs_md + class_template_dep + index_block_template_dep + module_intro_template_dep + [__file__, 'conf.py'] ,
            'targets': tdst,
            'actions': [
                (self.create_docs, ())
            ],
            'clean': True,
            'uptodate': [utils.config_changed({
                1: self.kw,
            })],
        }, self.kw['filters'])
github ubuntu-mate / ubuntu-mate.org / plugins / localsearch / localsearch / __init__.py View on Github external
data["url"] = post.permalink(lang, absolute=True)
                    pages.append(data)
            output = json.dumps({"pages": pages}, indent=2)
            makedirs(os.path.dirname(dst_path))
            with codecs.open(dst_path, "wb+", "utf8") as fd:
                fd.write(output)

        task = {
            "basename": str(self.name),
            "name": dst_path,
            "targets": [dst_path],
            "actions": [(save_data, [])],
            'uptodate': [config_changed(kw)],
            'calc_dep': ['_scan_locs:sitemap']
        }
        yield apply_filters(task, kw['filters'])

        # Copy all the assets to the right places
        asset_folder = os.path.join(os.path.dirname(__file__), "files")
        for task in copy_tree(asset_folder, kw["output_folder"]):
            task["basename"] = str(self.name)
            yield apply_filters(task, kw['filters'])
github openframeworks / ofSite / plugins / tutorials / tutorials / __init__.py View on Github external
if lang == self.site.config['DEFAULT_LANG']: 
                context["permalink"] = '/' + folder_name + '/'
            else:
                context["permalink"] = '/' + lang + '/' + folder_name + '/'
            context["of_book"] = of_book
            context["contributing_to_docs"] = contributing_to_docs
            context["title"] = "learning"
            context['categories'] = categories
            short_tdst = os.path.join(self.kw['translations'][lang], folder_name, "index.html")
            tdst = os.path.normpath(os.path.join(self.kw['output_folder'], short_tdst))
            template_dep = self.site.template_system.template_deps(template_name)
            template_dep += [contributing_to_docs_path]
            template_dep += files
            template_dep += [__file__]
            template_dep += [os.path.join(self.site.original_cwd, "messages", "of_messages_" + lang + ".py")]
            yield utils.apply_filters({
                'basename': self.name,
                'name': tdst,
                'file_dep': template_dep,
                'targets': [tdst],
                'actions': [
                    (self.site.render_template, (template_name, tdst, context))
                ],
                'clean': True,
                'uptodate': [utils.config_changed({
                    1: self.kw,
                })],
            }, self.kw['filters'])