1
0
mirror of https://github.com/venthur/blag.git synced 2025-11-25 20:52:43 +00:00

small template improvements

This commit is contained in:
Bastian Venthur
2021-01-14 16:28:41 +01:00
parent d3fe365bb0
commit 581f36abea
2 changed files with 12 additions and 5 deletions

View File

@@ -11,9 +11,6 @@ __author__ = "Bastian Venthur <venthur@debian.org>"
import argparse
import os
import shutil
import string
import codecs
import re
import logging
from datetime import datetime
@@ -119,6 +116,10 @@ def convert_to_html(convertibles):
value = value[0]
meta[key] = value
# convert known metadata
if 'date' in meta:
meta['date'] = datetime.fromisoformat(meta['date'])
context = dict(content=content)
context.update(meta)
# for now, treat all pages as articles
@@ -146,7 +147,7 @@ def convert_to_html(convertibles):
link=dst,
description=context['title'],
content=context['content'],
pubdate=datetime.fromisoformat(context['date']),
pubdate=context['date'],
)
with open('atom.xml', 'w') as fh:

View File

@@ -9,7 +9,13 @@
{% block content %}
<p>Written on {{ date }}.</p>
{% if title %}
<h1>{{ title }}</h1>
{% endif %}
{% if date %}
<p>Written on {{ date.date() }}.</p>
{% endif %}
{{ content }}