summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--__main__.py2
-rw-r--r--modules/blogpost_processor.py5
2 files changed, 5 insertions, 2 deletions
diff --git a/__main__.py b/__main__.py
index 14819f6..8083d9b 100644
--- a/__main__.py
+++ b/__main__.py
@@ -24,7 +24,7 @@ def main(output_root_path: str, local: bool):
os.mkdir(output_root_path)
jinja_env = init_jinja_env()
- posts = blogpost_processor.get_posts(Config.POST_SOURCE_DIR)
+ posts = blogpost_processor.get_posts(Config.POST_SOURCE_DIR, local)
tag_occurrence_count = {}
for post in posts:
for tag in post.meta_data[blogpost_processor.TAGS_KEY]:
diff --git a/modules/blogpost_processor.py b/modules/blogpost_processor.py
index a8833e2..f8c06c2 100644
--- a/modules/blogpost_processor.py
+++ b/modules/blogpost_processor.py
@@ -216,10 +216,13 @@ class Post:
return None
-def get_posts(path: str) -> list[Post]:
+def get_posts(path: str, local: bool) -> list[Post]:
return_list = []
for directory in os.listdir(path):
+ if directory.endswith(".unpublished") and not local:
+ continue
+
return_list.append(Post(os.path.join(path, directory)))
return_list.sort(key=lambda post: post.meta_data[PUBLISH_DATE_KEY], reverse=True)