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:
9
sg/sg.py
9
sg/sg.py
@@ -11,9 +11,6 @@ __author__ = "Bastian Venthur <venthur@debian.org>"
|
|||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import string
|
|
||||||
import codecs
|
|
||||||
import re
|
|
||||||
import logging
|
import logging
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
@@ -119,6 +116,10 @@ def convert_to_html(convertibles):
|
|||||||
value = value[0]
|
value = value[0]
|
||||||
meta[key] = value
|
meta[key] = value
|
||||||
|
|
||||||
|
# convert known metadata
|
||||||
|
if 'date' in meta:
|
||||||
|
meta['date'] = datetime.fromisoformat(meta['date'])
|
||||||
|
|
||||||
context = dict(content=content)
|
context = dict(content=content)
|
||||||
context.update(meta)
|
context.update(meta)
|
||||||
# for now, treat all pages as articles
|
# for now, treat all pages as articles
|
||||||
@@ -146,7 +147,7 @@ def convert_to_html(convertibles):
|
|||||||
link=dst,
|
link=dst,
|
||||||
description=context['title'],
|
description=context['title'],
|
||||||
content=context['content'],
|
content=context['content'],
|
||||||
pubdate=datetime.fromisoformat(context['date']),
|
pubdate=context['date'],
|
||||||
)
|
)
|
||||||
|
|
||||||
with open('atom.xml', 'w') as fh:
|
with open('atom.xml', 'w') as fh:
|
||||||
|
|||||||
@@ -9,7 +9,13 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<p>Written on {{ date }}.</p>
|
{% if title %}
|
||||||
|
<h1>{{ title }}</h1>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if date %}
|
||||||
|
<p>Written on {{ date.date() }}.</p>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{{ content }}
|
{{ content }}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user