summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rw-r--r--blog/blog.py13
-rw-r--r--blog/post.py3
-rw-r--r--posts/hello-world/hello-world.md (renamed from posts/drafts/hello-world/hello-world.md)0
-rw-r--r--posts/hello-world/metadata.txt (renamed from posts/drafts/hello-world/metadata.txt)1
-rw-r--r--share/style.css4
-rw-r--r--templates/feed.html4
7 files changed, 6 insertions, 23 deletions
diff --git a/Makefile b/Makefile
index 8eb3cb2..f491bc0 100644
--- a/Makefile
+++ b/Makefile
@@ -3,12 +3,12 @@ SHARE := $(shell find share -name '*' 2> /dev/null)
POSTS := $(shell find posts -name '*' 2> /dev/null)
CODE := $(shell find blog -name '*.py' 2> /dev/null)
-.PHONY: clean httpserver
+.PHONY: clean server
remote: $(TEMPLATES) $(SHARE) $(POSTS)
python3 blog/blog.py
-httpserver: remote
+server: remote
python3 -m http.server --directory remote
clean:
diff --git a/blog/blog.py b/blog/blog.py
index 8af9589..b682afc 100644
--- a/blog/blog.py
+++ b/blog/blog.py
@@ -3,6 +3,7 @@
import os
import shutil
+import argparse
from jinja2 import Environment, FileSystemLoader, select_autoescape
@@ -31,17 +32,11 @@ def copy_share(workdir):
shutil.copy(source, destination)
-def generate_blog(include_drafts=False):
+def generate_blog():
env = Environment(loader=FileSystemLoader(searchpath="templates"),
autoescape=select_autoescape())
- posts = find_posts(env.get_template("post.html"),
- os.path.join("posts", "public"))
-
- if include_drafts:
- drafts = find_posts(env.get_template("post.html"),
- os.path.join("posts", "drafts"))
- posts.extend(drafts)
+ posts = find_posts(env.get_template("post.html"), "posts")
workdir = "remote"
recreate_workdir(workdir)
@@ -56,7 +51,7 @@ def generate_blog(include_drafts=False):
def main():
- generate_blog(include_drafts=True)
+ generate_blog()
if __name__ == "__main__":
diff --git a/blog/post.py b/blog/post.py
index eab9d0d..ebf2e4c 100644
--- a/blog/post.py
+++ b/blog/post.py
@@ -43,9 +43,6 @@ class Post(object):
return Metadata(title, date, status)
- def is_draft(self):
- return self.metadata.status == "draft"
-
def generate(self, basedir):
postdir = os.path.basename(self.directory)
workdir = os.path.join(basedir, postdir)
diff --git a/posts/drafts/hello-world/hello-world.md b/posts/hello-world/hello-world.md
index 06639ae..06639ae 100644
--- a/posts/drafts/hello-world/hello-world.md
+++ b/posts/hello-world/hello-world.md
diff --git a/posts/drafts/hello-world/metadata.txt b/posts/hello-world/metadata.txt
index 800612c..3333eb3 100644
--- a/posts/drafts/hello-world/metadata.txt
+++ b/posts/hello-world/metadata.txt
@@ -1,3 +1,2 @@
Title: Hello, World!
Date: 2022-12-23
-Status: draft
diff --git a/share/style.css b/share/style.css
index 8dec075..0dc2450 100644
--- a/share/style.css
+++ b/share/style.css
@@ -34,10 +34,6 @@ h1, h2, h3, h4, h5, h6 {
color: var(--heading-color);
}
-/*time {
- color: #00000090;
-}*/
-
a {
color: var(--link-color);
cursor: pointer;
diff --git a/templates/feed.html b/templates/feed.html
index 86013bb..f8800bc 100644
--- a/templates/feed.html
+++ b/templates/feed.html
@@ -24,7 +24,6 @@
{% if posts %}
<ul class="posts">
{% for post in posts %}
-
<li>
<span>
<i>
@@ -35,9 +34,6 @@
</span>
<a href="{{ post.name }}">
{{ post.metadata.title }}
- {% if post.is_draft() %}
- (Draft)
- {% endif %}
</a>
</li>
{% endfor %}