-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtemplates.py
24 lines (21 loc) · 899 Bytes
/
templates.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from jinja2 import Template
body_template = Template("""
<html>
<head><meta charset="utf-8" name="viewport" content="width=device-width, initial-scale=1.0"></head>
<body>
<center><a href="https://www.reddit.com"><img src="cid:logo" alt="reddit-logo"></a></center>
{% for subreddit in data.keys() %}
<h2><a href="https://www.reddit.com/r/{{ subreddit }}">/r/{{ subreddit }}</a></h2>
<p style="font-size:18px;">
{% for post in data[subreddit] %}
<ul>
<p style="font-weight=900;">{{ post['score'] }}👏 {{ post['num_comments'] }}👶 <br>
<a href="{{ post['shortlink'] }}">{{ post['title'] }}</a><p/>
</ul>
{% endfor %}
</p>
{% endfor %}
</body>
</html>
"""
)