🎨 make output directories a config option
This commit is contained in:
parent
55483e4897
commit
f89a9683e0
26 changed files with 8 additions and 6 deletions
|
@ -7,8 +7,10 @@ from pathvalidate import validate_filename
|
|||
import os
|
||||
from tqdm import tqdm
|
||||
|
||||
from config import *
|
||||
|
||||
|
||||
include_title = False
|
||||
output_dir = "recipes-md"
|
||||
|
||||
|
||||
def valid_duration(duration):
|
||||
|
@ -114,8 +116,8 @@ def main(json_file):
|
|||
markdown_fn = f"{recipe.get('name', 'Untitled Recipe')}.md"
|
||||
validate_filename(markdown_fn) # XXX does this check directory traversal?
|
||||
markdown = format_recipe_to_markdown(recipe)
|
||||
os.makedirs(output_dir, exist_ok=True)
|
||||
with open(os.path.join(output_dir, markdown_fn), "w") as f:
|
||||
os.makedirs(OUTDIR_MARKDOWN, exist_ok=True)
|
||||
with open(os.path.join(OUTDIR_MARKDOWN, markdown_fn), "w") as f:
|
||||
f.write(markdown)
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue