...

Text file src/github.com/noirbizarre/gonja/testData/complex.tpl

Documentation: github.com/noirbizarre/gonja/testData

     1{# A more complex template using gonja #}
     2<!DOCTYPE html>
     3<html>
     4
     5<head>
     6	<title>My blog page</title>
     7</head>
     8
     9<body>
    10	<h1>Blogpost</h1>
    11	<div id="content">
    12		{{ complex.post.Text|safe }}
    13	</div>
    14
    15	<h1>Comments</h1>
    16
    17	{% for comment in complex.comments %}
    18		<h2>{{ loop.index }}. Comment ({{ loop.revindex}} comment{% if loop.revindex > 1 %}s{% endif %} left)</h2>
    19		<p>From: {{ comment.Author.Name }} ({% if comment.Author.Validated %}validated{% else %}not validated{% endif %})</p>
    20
    21		{% if complex.is_admin(comment.Author) %}
    22			<p>This user is an admin (verify: {{ comment.Author.IsAdmin() }})!</p>
    23		{% else %}
    24			<p>This user is not admin!</p>
    25		{% endif %}
    26
    27		<p>Written {{ comment.Date }}</p>
    28		<p>{{ comment.Text|striptags }}</p>
    29	{% endfor %}
    30</body>
    31
    32</html>

View as plain text