summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rwxr-xr-xscripts/bupa23
-rw-r--r--src/templates/entry.html1
-rw-r--r--src/templates/journal.html4
4 files changed, 28 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index c9ef1c1..01ed0e3 100644
--- a/Makefile
+++ b/Makefile
@@ -11,7 +11,7 @@ build/%/:
mkdir $@
clean:
- -rm -r $(addprefix build/, $(FILES)) build/journal build/resources
+ -rm -r $(addprefix build/, $(FILES)) build/journal.xml build/journal build/resources
build/index.html: src/index.rst
@./scripts/bupa index.html
diff --git a/scripts/bupa b/scripts/bupa
index 7220ceb..e1d57cf 100755
--- a/scripts/bupa
+++ b/scripts/bupa
@@ -7,6 +7,8 @@ Options:
from jinja2 import Environment, FileSystemLoader
import glob, yaml, docopt
from docutils import core
+from pyatom import AtomFeed
+
def reST_to_html(s):
return core.publish_parts(s, writer_name='html4css1')['fragment']
@@ -49,6 +51,14 @@ def build_journal(env):
files = glob.glob('src/journal/*.rst')
files.sort(key=filename_to_id, reverse=True)
+ feed = AtomFeed(
+ title="kyrias’ journal",
+ subtitle="The lost journal of Kyrias",
+ feed_url="https://theos.kyriasis.com/~kyrias/journal.xml",
+ url="https://theos.kyriasis.com/~kyrias/journal.html",
+ author="Johannes Löthberg",
+ )
+
entries = []
for file in files:
entry = parse(file)
@@ -59,9 +69,20 @@ def build_journal(env):
with open('build/'+entry.page, 'w') as file:
file.write(entry_tmpl.render(entry=entry, title='~/journal',
header='The lost journal'))
+ feed.add(
+ title=entry.title,
+ content=entry.body,
+ content_type="html",
+ author={'name': entry.author, 'uri': entry.author_link},
+ url="https://theos.kyriasis.com/~kyrias/"+entry.page,
+ updated=entry.date
+ )
with open('build/journal.html', 'w') as file:
- file.write(template.render(entries=entries, title='~/journal', header='The lost journal'))
+ file.write(template.render(entries=entries, title='~/journal',
+ header='The lost journal'))
+ with open('build/journal.xml', 'w') as file:
+ file.write(feed.to_string())
def build_page(env, templ_name, pagename):
template = env.get_template(templ_name)
diff --git a/src/templates/entry.html b/src/templates/entry.html
index 1f23123..3bc2fbd 100644
--- a/src/templates/entry.html
+++ b/src/templates/entry.html
@@ -2,6 +2,7 @@
{% block head %}
<link href="isso.css" rel="stylesheet">
+ <link href="../journal.xml" type="application/atom+xml" rel="alternate" title="Journal Atom feed" />
{% endblock head %}
{% block content %}
diff --git a/src/templates/journal.html b/src/templates/journal.html
index 7f5dfc4..619a3ee 100644
--- a/src/templates/journal.html
+++ b/src/templates/journal.html
@@ -1,5 +1,9 @@
{% extends 'layout.html' %}
+{% block head %}
+ <link href="journal.xml" type="application/atom+xml" rel="alternate" title="Journal Atom feed" />
+{% endblock head %}
+
{% block content %}
{% for entry in entries %}
<article itemscope itemtype="http://schema.org/Article"