From b8cd2d937eb0e305509d1ffc70a52315320541c8 Mon Sep 17 00:00:00 2001 From: Johannes Löthberg Date: Wed, 15 Oct 2014 18:39:56 +0100 Subject: refactor bupa slightly, add isso comments on separate entry pages --- scripts/bupa | 9 +++++++-- src/journal/1-hello-world.rst | 2 +- src/templates/entry.html | 37 +++++++++++++++++++++++++++++++++++++ src/templates/journal.html | 1 + src/templates/layout.html | 6 ++++-- src/templates/nav.html | 6 +++--- 6 files changed, 53 insertions(+), 8 deletions(-) create mode 100644 src/templates/entry.html diff --git a/scripts/bupa b/scripts/bupa index b982ec8..0ed31e6 100755 --- a/scripts/bupa +++ b/scripts/bupa @@ -46,16 +46,21 @@ def parse(filename): return page def build_journal(env): - template = env.get_template('journal.html') + template = env.get_template('journal.html') + entry_tmpl = env.get_template('entry.html') files = os.listdir('src/journal') files.sort(key=filename_to_id, reverse=True) entries = [] for file in files: entry = parse('src/journal/' + file) - entry.body = reST_to_html(entry.body) entry.id = filename_to_id(file) + entry.page = 'journal/' + file.split('.', 1)[0] + '.html' + entry.body = reST_to_html(entry.body) entries += [entry] + with open('build/'+entry.page, 'w') as file: + file.write(entry_tmpl.render(entry=entry, title='~/journal', + header='The lost journal')) with open('build/journal.html', 'w') as file: file.write(template.render(entries=entries, title='~/journal', header='The lost journal')) diff --git a/src/journal/1-hello-world.rst b/src/journal/1-hello-world.rst index a7f77bc..b5827a4 100644 --- a/src/journal/1-hello-world.rst +++ b/src/journal/1-hello-world.rst @@ -2,7 +2,7 @@ title: Hello, World date: 2014-10-14 author: Johannes Löthberg - author_link: about.html + author_link: /~kyrias/about.html I should probably write an entry some time. I’ve been thinking about what to write about for a while but I can’t really think of anything that I’d want people to read. (Not that I expect anyone to actually read this, eh…) Could write about what I’m doing and how I’m poking and prodding at this site maybe? Or maybe something related to LDAP, or setting up OpenSMTPD and Dovecot, or maybe bind, or even Kerberos… All of them could be useful for future reference for myself in either case I guess. diff --git a/src/templates/entry.html b/src/templates/entry.html new file mode 100644 index 0000000..1988537 --- /dev/null +++ b/src/templates/entry.html @@ -0,0 +1,37 @@ +{% extends 'layout.html' %} + +{% block head %} + +{% endblock head %} + +{% block content %} +
+ +

{{ entry.title }}

+ +
+ Published on + + + +
+ + {{ entry.body }} +
+ + +
+ +{% endblock content %} diff --git a/src/templates/journal.html b/src/templates/journal.html index 9f301b1..a4bef7f 100644 --- a/src/templates/journal.html +++ b/src/templates/journal.html @@ -20,6 +20,7 @@ by {{ entry.author }} {% endif %} + | comments {{ entry.body }} diff --git a/src/templates/layout.html b/src/templates/layout.html index c91aa94..3c9db2f 100644 --- a/src/templates/layout.html +++ b/src/templates/layout.html @@ -3,11 +3,13 @@ {{ title }} - + + +{% block head %}{% endblock %}
@@ -34,7 +36,7 @@ - hacker emblem + hacker emblem diff --git a/src/templates/nav.html b/src/templates/nav.html index e40b4ed..fddd9bc 100644 --- a/src/templates/nav.html +++ b/src/templates/nav.html @@ -1,7 +1,7 @@ -- cgit v1.2.3-70-g09d2