summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJohannes Löthberg <johannes@kyriasis.com>2014-10-20 17:47:01 +0200
committerJohannes Löthberg <johannes@kyriasis.com>2014-10-20 17:47:01 +0200
commitae0f7768119984ca21238eee31fcb71931970dcb (patch)
tree6d670f664c3eb657cfab72562d1108f264d75568 /scripts
parent3e0a06445b130a68f9a2401b5d8b52e9283b92ec (diff)
downloadwebsite-ae0f7768119984ca21238eee31fcb71931970dcb.tar.xz
use pyatom to generate journal feed
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/bupa23
1 files changed, 22 insertions, 1 deletions
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)