32 lines
925 B
HTML
32 lines
925 B
HTML
{% macro author(name, ctime, mtime) %}
|
|
<p><sub><i>{{ name }} - {{ format_since(ctime) }}{% if ctime != mtime %} (last modified {{ format_since(mtime) }}){% endif %}</i></sub></p>
|
|
{% endmacro %}
|
|
|
|
{% macro render_comment_pre(comment) %}
|
|
<div class=comment>
|
|
{{ author(comment.author, comment.create_time, comment.modify_time) }}
|
|
<p>{{ comment.text }}</p>
|
|
{% endmacro %}
|
|
|
|
{% macro render_comment_post(comment) %}
|
|
{% for c in comment.children %}
|
|
{{ render_comment(c) }}
|
|
{% endfor %}
|
|
</div>
|
|
{% endmacro %}
|
|
|
|
{% macro render_comment(comment) %}
|
|
{{ render_comment_pre(comment) }}
|
|
<sup><a href="{{ url_for("comment", comment_id = comment.id) }}">reply</a></sup>
|
|
{{ render_comment_post(comment) }}
|
|
{% endmacro %}
|
|
|
|
{% macro reply() %}
|
|
{% if 'user_id' in session %}
|
|
<form method="post" action="comment/">
|
|
<p><textarea name="text"></textarea></p>
|
|
<p><input type="submit" value="Post comment"></p>
|
|
</form>
|
|
{% endif %}
|
|
{% endmacro %}
|