leichte Layout-Aufhuebschungen

This commit is contained in:
lars 2015-04-25 21:58:21 +00:00
parent e84e413dd7
commit 297b268395
6 changed files with 85 additions and 61 deletions

View file

@ -4,45 +4,11 @@
<py:match path="head" once="true">
<head py:attrs="select('@*')">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
${select('*|text()')}
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
${select('*|text()')}
</head>
</py:match>
<?python
import creoleparser
import genshi
import datetime
def formatter(text):
if not text:
return u""
text = text.replace("\\", "\\\\")
html = creoleparser.text2html(text, encoding=None).strip()
if html.startswith("<p>") and html.endswith("</p>"):
html = html[3:-4]
return genshi.Markup(html)
TODAY_FORMAT = "%H:%M"
FULL_FORMAT = "%d.%m.%y %H:%M"
last_day = datetime.datetime.today() - datetime.timedelta(days=1)
def show_timestamp(date):
if date <= last_day:
template = TODAY_FORMAT
else:
template = FULL_FORMAT
return date.strftime(template)
def nav_links():
result = []
if prev_link:
result.append('<a href="%s" title="zeige neuere Eintr&auml;ge">aktuellere</a>' % prev_link)
if next_link:
result.append('<a href="%s" title="zeige &auml;ltere Eintr&auml;ge">&auml;ltere</a>' % next_link)
return genshi.Markup(" | ".join(result))
?>
<py:match path="body" once="true">
<body py:attrs="select('@*')">