template paths

This commit is contained in:
cellarspoon 2021-12-15 11:55:51 +01:00
parent c0dd9c51af
commit 3b56fca00e
No known key found for this signature in database
GPG Key ID: 03789458B3D0C410
4 changed files with 12 additions and 5 deletions

View File

@ -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)

View File

@ -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()

View File

@ -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):

View File

@ -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)