def _write_ruleset(self, output_dir, ruleset):
# Load template and render Markdown.
template = self.__env.get_template('markdown.jinja')
out = template.render(ruleset=ruleset)
# Write output to file. Output files are created in a directory structure
# that matches that of the input file.
output_path = ruleset.output_file + '.md'
output_file = "%s/%s" % (output_dir, output_path)
file_dirname = os.path.dirname(output_file)
if not os.path.exists(file_dirname):
os.makedirs(file_dirname)
with open(output_file, "w") as f:
f.write(out)
return (output_file, output_path)
评论列表
文章目录