comparison themes/default/static_blog.html @ 712:bf562fb9c273

server_side: use Jinja2 template engine for static blog
author souliane <souliane@mailoo.org>
date Mon, 13 Jul 2015 18:11:38 +0200
parents
children 916075bd0356
comparison
equal deleted inserted replaced
711:052d1d19016d 712:bf562fb9c273
1 {#
2 Libervia: a Salut à Toi frontend
3 Copyright (C) 2011, 2012, 2013, 2014, 2015 Jérôme Poisson <goffi@goffi.org>
4 Copyright (C) 2013, 2014, 2015 Adrien Cossa <souliane@mailoo.org>
5
6
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Affero General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Affero General Public License for more details.
16
17 You should have received a copy of the GNU Affero General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #}
20
21 {% macro message(entry) -%}
22
23 <div class="mblog_entry {{ entry.style }}">
24 {% if entry.type == "comment" %}
25 <div class="mblog_header">
26 <div class="mblog_metadata">
27 <div class="mblog_author">{{entry.author}}</div>
28 <div class="mblog_timestamp">{{entry.date}}</div>
29 </div>
30 </div>
31 {% else %}
32 <a href="{{entry.url}}" class="item_link">
33 <div class="mblog_header mblog_header_main">
34 <div class="mblog_metadata">
35 <div class="mblog_author">{{entry.author}}</div>
36 <div class="mblog_timestamp">{{entry.date}}</div>
37 </div>
38 </div>
39 </a>
40 {% endif %}
41 <span class="mblog_content">
42 {% if entry.message_title %}
43 <h1><a href="{{entry.url}}" class="item_link">{{entry.title}}</a></h1>
44 {% endif %}
45 {{entry.content}}
46 </span>
47 {% if entry.type == "main_item" %}
48 <a href="{{entry.url}}" class="item_link">
49 <div class="mblog_footer mblog_footer_main">
50 <div class="mblog_metadata">
51 <div class="mblog_comments">{{ entry.comments_text }}</div>
52 </div>
53 </div>
54 </a>
55 {% endif %}
56 </div>
57 {% if entry.all_comments_link %}
58 {{ link(entry.all_comments_link) }}
59 {% endif %}
60
61 {% for comment in entry.comments %}
62 {{ message(comment) }}
63 {% endfor %}
64
65 {%- endmacro %}
66
67 {% macro link(entry) -%}
68 <a href="{{entry.url}}" class="{{entry.style}}">{{entry.text}}</a>
69 {%- endmacro %}
70
71 {% macro image(entry) -%}
72 <img src="{{entry.url}}" alt="{{entry.alt}}"/>
73 {%- endmacro %}
74
75 <html>
76 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
77 <meta name="keywords" content="{{keywords}}">
78 <meta name="description" content="{{description}}">
79 <link rel="alternate" type="application/atom+xml" href="{{base_url}}/atom.xml"/>
80 <link rel='stylesheet' type="text/css" href='{{styles}}/blog.css'>
81 <link rel="icon" type="image/png" href="{{favicon}}">
82
83 <head profile="http://www.w3.org/2005/10/profile">
84 <title>{{title}}</title>
85 </head>
86
87 <body>
88 <div class="mblog_title"><a href="{{base_url}}">
89 {{ image(banner_img) }}
90 {{ title }}
91 </a></div>
92
93 <div class="header">
94 <div class="header_content">
95 {{ link(navlinks.later_message) }}
96 {{ link(navlinks.later_messages) }}
97 {{ link(navlinks.older_message) }}
98 </div>
99 </div>
100
101 {% for entry in messages %}
102 {{ message(entry) }}
103 {% endfor %}
104
105 <div class="footer">
106 <div class="footer_content">
107 {{ link(navlinks.older_messages) }}
108 </div>
109 </div>
110 </body>
111 </html>