add anchors to posts

This commit is contained in:
Sebastian Hugentobler 2015-05-13 11:43:17 +02:00
parent 2cf6ef7c6f
commit a899e9f5a9
2 changed files with 6 additions and 1 deletions

View File

@ -12,6 +12,9 @@ import argparse, json, os, re, shutil
from datetime import datetime from datetime import datetime
from jinja2 import Environment, FileSystemLoader from jinja2 import Environment, FileSystemLoader
import sys
reload(sys); sys.setdefaultencoding('utf-8')
def fromunixtime(value): def fromunixtime(value):
return datetime.fromtimestamp(value).strftime('%Y-%m-%d %H:%M:%S') return datetime.fromtimestamp(value).strftime('%Y-%m-%d %H:%M:%S')

View File

@ -9,7 +9,9 @@
<body> <body>
<h1>{{ thread.title }}</h1> <h1>{{ thread.title }}</h1>
{% for post in thread.posts %} {% for post in thread.posts %}
<h3><a href={{ "../../user/" + post.user.name |url_replacer + ".html" }}>{{ post.user.name }}</a> - {{ post.timestamp | fromunixtime }}</h3> <a href="#{{ loop.index }}">{{ loop.index }} - </a>
<b><a name="{{ loop.index }}" href={{ "../../user/" + post.user.name |url_replacer + ".html" }}>{{ post.user.name }}</a></b>
<i>({{ post.timestamp | fromunixtime }})</i>
<p>{{ post.message | tohtml }}</p> <p>{{ post.message | tohtml }}</p>
{% for attachment in post.attachments %} {% for attachment in post.attachments %}
--<br> --<br>