How to use the nikola.utils 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 diegosarmentero / documentor / docdump.py View on Github external
'year': str(datetime.date.today().year),
            'projectname': self.projectname
        }

        path = os.path.join(self.files_folder, 'documentor_classes.html')
        with open(path, 'w') as f:
            f.write(html)

        # Functions
        html = templates.HTML_FILES_HEADER % {
            'projectname': self.projectname,
            'type': 'Functions'
        }
        for fun in sorted(self.__functions, key=lambda x: x[0]):
            name_to_slugy = os.path.splitext(fun[1])[0]
            slugy = utils.slugify(name_to_slugy.decode('utf-8'))
            html += templates.HTML_FILES_BODY % {
                'link': "%s#%s-%d" % (fun[1], slugy, fun[2]),
                'name': fun[0]
            }
        html += templates.HTML_FILES_FOOTER % {
            'year': str(datetime.date.today().year),
            'projectname': self.projectname
        }

        path = os.path.join(self.files_folder, 'documentor_functions.html')
        with open(path, 'w') as f:
            f.write(html)
github openframeworks / ofSite / plugins / tutorials / tutorials / __init__.py View on Github external
if not is_translation:
                        articles.append(articleobj)
                    else:
                        translations.append(articleobj)
                elif os.path.isdir(folder):
                    for lang in self.kw['translations']:
                        if lang == self.site.config['DEFAULT_LANG']: 
                            out_folder = os.path.join(self.site.original_cwd, 'output',folder_name,catfolder,article.lower())
                        else:
                            out_folder = os.path.join(self.site.original_cwd, 'output',lang,folder_name,catfolder,article.lower())
                            
                        for root, dirs, file_ins in os.walk(folder):
                            for f in file_ins:
                                in_path = os.path.join(root,f)
                                out_path = os.path.join(out_folder, f)
                                yield utils.apply_filters({
                                    'basename': self.name,
                                    'name': in_path + "." + lang,
                                    'file_dep': [in_path, __file__],
                                    'targets': [out_path],
                                    'actions': [
                                        (create_file, (in_path, out_path))
                                    ],
                                    'clean': True,
                                    'uptodate': [utils.config_changed({
                                        1: self.kw,
                                    })],
                                }, self.kw['filters'])
            
                
            def find_translations(article):
                article_file_name = os.path.splitext(article.file)[0]
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,
                }, {})