zettel/templates/posts.html

40 lines
1.2 KiB
HTML

{% extends "base.html" %}
{% block content %}
<div class="info">
{{ session }}
{{ session.user_name }}
{% if session.user_id == 1 %}
<a href="{{url_for('login_form')}}">Login</a>
{% else %}
<a href="{{url_for('logout')}}">Logout</a>
{% endif %}
</div>
<div class="tagcloud">
{% for tag in tags %}
<a href="{{tag.link}}" class="tag {% if tag['selected'] %}selected{% endif %}">{{tag['name']}}</a>
{% endfor %}
</div>
<main>
<p>{{posts | length}} posts:</p>
{% for post in posts %}
<article class="{%if post.superceded_by%}superceded{%endif%}">
<div class="tagcloud">
{% for tag in tags_by_post[post.id] %}
<a href="{{tag.link}}" class="tag {% if tag['selected'] %}selected{% endif %}">{{tag['name']}}</a>
{% endfor %}
</div>
{% if post.content_type == "text/html" %}
<!-- for now I trust myself -->
{{ post.text | safe }}
{% elif post.content_type == "text/markdown" %}
{{post.text | markdown}}
{% else %}
<pre>{{post.text}}</pre>
{% endif %}
</article>
{% endfor %}
</main>
{% endblock content %}