Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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'])
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]
it = filter((lambda possible_translation: os.path.splitext(os.path.splitext(possible_translation.file)[0])[0] == article_file_name), translations)
article_translations = {}
for translation in it:
translation.original = article
article_translations[translation.lang] = translation
return article_translations
def collect_translations(article):
article.translations = find_translations(article)
data["title"] = post.title(lang)
data["text"] = text
data["tags"] = ",".join(post.tags)
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'])