diff --git a/lumbunglib/calendar.py b/lumbunglib/calendar.py index 9ac552e..5720420 100644 --- a/lumbunglib/calendar.py +++ b/lumbunglib/calendar.py @@ -6,6 +6,7 @@ import os import re import shutil +from pathlib import Path from urllib.parse import urlparse import arrow @@ -28,7 +29,8 @@ env = jinja2.Environment(loader=jinja2.FileSystemLoader(os.path.curdir)) if not os.path.exists(output_dir): os.mkdir(output_dir) -template = env.get_template("event_template.md") +cwd = Path.resolve() +template = env.get_template(os.path.join(cwd, "templates" "calendar.md")) existing_posts = os.listdir(output_dir) @@ -200,7 +202,6 @@ for event in list(cal.events): event.uid ) # create list of posts which have not been returned by the calendar - for post in existing_posts: # remove events not returned by the calendar (deletion) print("deleted", post) diff --git a/lumbunglib/feed.py b/lumbunglib/feed.py index 94a523e..8541085 100644 --- a/lumbunglib/feed.py +++ b/lumbunglib/feed.py @@ -7,6 +7,7 @@ import os import shutil import time from ast import literal_eval as make_tuple +from pathlib import Path from urllib.parse import urlparse import arrow @@ -201,7 +202,8 @@ output_dir = os.environ.get( if not os.path.exists(output_dir): os.makedirs(output_dir) -template = env.get_template("post_template.md") +cwd = Path.resolve() +template = env.get_template(os.path.join(cwd, "templates" "feed.md")) # add iframe to the allowlist of feedparser's sanitizer, # this is now handled in parse_post() diff --git a/lumbunglib/hashtag.py b/lumbunglib/hashtag.py index 2bd8eb4..cb58c45 100644 --- a/lumbunglib/hashtag.py +++ b/lumbunglib/hashtag.py @@ -6,6 +6,7 @@ import os import shutil +from pathlib import Path import jinja2 import requests @@ -115,7 +116,8 @@ env = jinja2.Environment(loader=jinja2.FileSystemLoader(os.path.curdir)) env.filters["localize_media_url"] = localize_media_url env.filters["filter_mastodon_urls"] = filter_mastodon_urls -template = env.get_template("post_template.md") +cwd = Path.resolve() +template = env.get_template(os.path.join(cwd, "templates" "hashtag.md")) if not os.path.exists(output_dir): diff --git a/lumbunglib/video.py b/lumbunglib/video.py index f1af36c..92bdadd 100644 --- a/lumbunglib/video.py +++ b/lumbunglib/video.py @@ -8,6 +8,7 @@ import datetime import json import os import shutil +from pathlib import Path import arrow import jinja2 @@ -118,7 +119,8 @@ output_dir = os.environ.get( if not os.path.exists(output_dir): os.mkdir(output_dir) -template = env.get_template("index_template.md") +cwd = Path.resolve() +template = env.get_template(os.path.join(cwd, "templates" "video.md")) existing_posts = os.listdir(output_dir)