Files
qgreper/templates/comment.html
2022-10-08 00:32:55 +02:00

32 lines
940 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>{{ minimd(comment.text) | safe }}</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 %}