aboutsummaryrefslogtreecommitdiff
path: root/build.py
diff options
context:
space:
mode:
authorChristian Cleberg <[email protected]>2025-07-07 09:42:46 -0500
committerGitHub <[email protected]>2025-07-07 09:42:46 -0500
commit6049be28667a0c2b4fe2cf0383c1b6d810b96540 (patch)
treeb014c037e61b1c16eef2efab01e7bde9f16d5b21 /build.py
parent36d48b11e11a83974e04b0c09b402badc7d3baf7 (diff)
parentdd370bcb709f5557b5a792f473ffe0bce4510d40 (diff)
downloadcleberg.net-6049be28667a0c2b4fe2cf0383c1b6d810b96540.tar.gz
cleberg.net-6049be28667a0c2b4fe2cf0383c1b6d810b96540.tar.bz2
cleberg.net-6049be28667a0c2b4fe2cf0383c1b6d810b96540.zip
Merge pull request #1 from ccleberg/theme-enhancements
Theme enhancements
Diffstat (limited to 'build.py')
-rw-r--r--build.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/build.py b/build.py
index 59118fb..ee947f3 100644
--- a/build.py
+++ b/build.py
@@ -115,6 +115,7 @@ def get_recent_posts_html(content_dir="./content/blog", num_posts=3):
"date": re.compile(r"^#\+date:\s*<(\d{4}-\d{2}-\d{2})"),
"slug": re.compile(r"^#\+slug:\s*(.+)$", re.IGNORECASE),
"filetags": re.compile(r"^#\+filetags:\s*(.+)$", re.IGNORECASE),
+ "draft": re.compile(r"^#\+draft:\s*(.+)$", re.IGNORECASE),
}
for org_path in Path(content_dir).glob("*.org"):
@@ -122,6 +123,7 @@ def get_recent_posts_html(content_dir="./content/blog", num_posts=3):
date_str = None
slug = None
tags = []
+ is_draft = False
with org_path.open("r", encoding="utf-8") as f:
for line in f:
@@ -153,10 +155,21 @@ def get_recent_posts_html(content_dir="./content/blog", num_posts=3):
tags = [t for t in raw.split(":") if t]
continue
+ m = header_patterns["draft"].match(line)
+ if m:
+ draft_value = m.group(1).strip().lower()
+ if draft_value != "nil":
+ is_draft = True
+ break
+ continue
+
# Stop scanning once we have all required fields
if title and date_str and slug and tags:
break
+ if is_draft:
+ continue
+
if title and date_str and slug:
try:
date_obj = datetime.strptime(date_str, "%Y-%m-%d")