Skip to content

Commit 17f42f8

Browse files
committed
update templates for sendy migration
1 parent 145dccf commit 17f42f8

7 files changed

Lines changed: 203 additions & 156 deletions

File tree

weeklypedia/bake.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@
3636
ARCHIVE_INDEX_PATH_TMPL = ARCHIVE_BASE_PATH + '/{lang_shortcode}/index.html'
3737
ARCHIVE_PATH_TMPL = pjoin(ARCHIVE_BASE_PATH, ARCHIVE_PATH_TMPL)
3838

39+
with open(os.path.join(_CUR_PATH, 'secrets.json')) as secrets_json:
40+
secrets = json.load(secrets_json)
41+
SENDY_ID_MAP = secrets.get('sendy_ids')
3942

4043
class Issue(object):
4144
def __init__(self,
@@ -185,6 +188,7 @@ def render_issue(render_ctx, issue_ashes_env,
185188
lang = render_ctx['short_lang_name']
186189
env = issue_ashes_env
187190
ctx = localize_data(render_ctx, lang)
191+
ctx['list_id'] = SENDY_ID_MAP[lang]
188192
if format == 'html':
189193
ret = lang_fallback_render(env, lang, 'archive.html', ctx)
190194
elif format == 'email':
@@ -236,7 +240,7 @@ def render_archive(issue_ashes_env, lang):
236240
ret['issues'].insert(0, {'path': archive_path,
237241
'date': display_date})
238242
ret['lang'] = LANG_MAP[lang]
239-
ret['signup_url'] = SIGNUP_MAP[lang]
243+
ret['list_id'] = SENDY_ID_MAP[lang]
240244
return issue_ashes_env.render('template_archive_index.html', ret)
241245

242246

weeklypedia/issue_templates/base/archive.html

Lines changed: 64 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -12,57 +12,73 @@
1212
<title>$HEAD_TITLE$</title>
1313
</head>
1414
<body>
15-
<div class="header">
16-
<h1><span>$BODY_TITLE$</span></h1>
17-
<p>$DESCRIPTION$</p>
18-
<p>$DELIVERY_DESCRIPTION$</p>
19-
</div>
20-
<div class="announce">
21-
<ul class="breadcrumb">
22-
<li><a href="../../../index.html">$HOME_LINK$</a></li>
23-
<li><a href="../index.html">$ARCHIVE_LINK$</a></li>
24-
<li>$ISSUE_LABEL$</li>
25-
</ul>
26-
</div>
27-
<div class="main">
28-
<div class="content">
29-
<p id="intro">{intro|s}</p>
30-
<h2 id="articles">$ARTICLES_HEADING$</h2>
31-
<p>{#stats}$ARTICLES_SUMMARY${/stats} $ARTICLES_INTRO$:</p>
32-
<ol>
33-
{#mainspace}
34-
<li><a href="https://{short_lang_name}.wikipedia.org/wiki/{title}" target="_blank">{title_s}</a> <span dir="ltr">(<a href="https://{short_lang_name}.wikipedia.org/w/index.php?title={title}&diff={rev_ids.new}&oldid={rev_ids.old}">$DIFF_COUNT$</a> $DIFF_AUTHOR_COUNT$)</span></li>
35-
{/mainspace}
36-
</ol>
15+
<div class="container">
16+
<div class="header">
17+
<h1><span>$BODY_TITLE$</span></h1>
18+
<p>$DESCRIPTION$</p>
19+
<p>$DELIVERY_DESCRIPTION$</p>
20+
</div>
21+
<div class="announce">
22+
<ul class="breadcrumb">
23+
<li><a href="../../../index.html">$HOME_LINK$</a></li>
24+
<li><a href="../index.html">$ARCHIVE_LINK$</a></li>
25+
<li>$ISSUE_LABEL$</li>
26+
</ul>
27+
</div>
28+
<div class="main">
29+
<div class="content">
30+
<p id="intro">{intro|s}</p>
31+
<h2 id="articles">$ARTICLES_HEADING$</h2>
32+
<p>{#stats}$ARTICLES_SUMMARY${/stats} $ARTICLES_INTRO$:</p>
33+
<ol>
34+
{#mainspace}
35+
<li><a href="https://{short_lang_name}.wikipedia.org/wiki/{title}" target="_blank">{title_s}</a> <span dir="ltr">(<a href="https://{short_lang_name}.wikipedia.org/w/index.php?title={title}&diff={rev_ids.new}&oldid={rev_ids.old}">$DIFF_COUNT$</a> $DIFF_AUTHOR_COUNT$)</span></li>
36+
{/mainspace}
37+
</ol>
3738

38-
<h2 id="new-articles">$NEW_ARTICLES_HEADING$</h2>
39-
<p>$NEW_ARTICLES_INTRO$</p>
40-
<ol>
41-
{#new_articles}
42-
<li><a href="https://{short_lang_name}.wikipedia.org/wiki/{title}" target="_blank">{title_s}</a> <span dir="ltr">($DIFF_COUNT$ $DIFF_AUTHOR_COUNT$)</span></li>
43-
{/new_articles}
44-
</ol>
39+
<h2 id="new-articles">$NEW_ARTICLES_HEADING$</h2>
40+
<p>$NEW_ARTICLES_INTRO$</p>
41+
<ol>
42+
{#new_articles}
43+
<li><a href="https://{short_lang_name}.wikipedia.org/wiki/{title}" target="_blank">{title_s}</a> <span dir="ltr">($DIFF_COUNT$ $DIFF_AUTHOR_COUNT$)</span></li>
44+
{/new_articles}
45+
</ol>
4546

46-
<h2 id="discussions">$DISCUSSIONS_HEADING$</h2>
47-
<p>$DISCUSSIONS_INTRO$:</p>
48-
<ol>
49-
{#talkspace}
50-
<li><a href="https://{short_lang_name}.wikipedia.org/wiki/Talk:{title}" target="_blank">{title_s}</a></li>
51-
{/talkspace}
52-
</ol>
47+
<h2 id="discussions">$DISCUSSIONS_HEADING$</h2>
48+
<p>$DISCUSSIONS_INTRO$:</p>
49+
<ol>
50+
{#talkspace}
51+
<li><a href="https://{short_lang_name}.wikipedia.org/wiki/Talk:{title}" target="_blank">{title_s}</a></li>
52+
{/talkspace}
53+
</ol>
5354

54-
<h2 id="statistics">$STATS_HEADING$</h2>
55-
<p>$STATS_INTRO$:</p>
56-
<ul>
57-
<li>$USER_EDIT_COUNTS$</li>
58-
<li>$ANON_EDIT_COUNTS$</li>
59-
<li>$BOT_EDIT_COUNTS$</li>
60-
</ul>
61-
<a href="{signup_url}" class="signup"><span>$SIGNUP_LINK$</span></a>
62-
<div class="content">
63-
<h2>$ABOUT_HEADING$</h2>
64-
<p>$ABOUT_TEXT$</p>
65-
<p><a href="http://blog.hatnote.com/">$BLOG_LINK$</a>.</p>
55+
<h2 id="statistics">$STATS_HEADING$</h2>
56+
<p>$STATS_INTRO$:</p>
57+
<ul>
58+
<li>$USER_EDIT_COUNTS$</li>
59+
<li>$ANON_EDIT_COUNTS$</li>
60+
<li>$BOT_EDIT_COUNTS$</li>
61+
</ul>
62+
63+
<h2>$SIGNUP$</h2>
64+
<p>$PITCH$</p>
65+
66+
<form action="https://mailer.hatnote.com/s/subscribe" method="POST" accept-charset="utf-8">
67+
<label class="email-label" for="email">$EMAIL$</label>
68+
<input class="email-input" type="email" name="email" id="email"/>
69+
<div style="display:none;">
70+
<label for="hp">HP</label><br/>
71+
<input type="text" name="hp" id="hp"/></div>
72+
<input type="hidden" name="list" value="{list_id}"/>
73+
<input type="hidden" name="subform" value="yes"/>
74+
<input class="sub-button" type="submit" name="submit" value="$SUBSCRIBE$" id="submit"/>
75+
</form>
76+
77+
<div class="content">
78+
<h2>$ABOUT_HEADING$</h2>
79+
<p>$ABOUT_TEXT$</p>
80+
<p><a href="http://blog.hatnote.com/">$BLOG_LINK$</a>.</p>
81+
</div>
6682
</div>
6783
</div>
6884
<script>

weeklypedia/issue_templates/base/email.html

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,29 @@ <h2 style="margin: 40px 0 10px;padding: 0;font: 800 Sans-Serif;font-size: 28px;l
6262
<td style="margin: 0;padding: 0;font-family: Sans-Serif;font-size: 100%;line-height: 1.6;"></td>
6363
</tr>
6464
</table>
65+
66+
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="background-color:#ffffff;border-top:1px solid #e5e5e5">
67+
<tbody><tr>
68+
<td align="center" valign="top" style="padding-top:20px;padding-bottom:20px">
69+
<table border="0" cellpadding="0" cellspacing="0">
70+
<tbody><tr>
71+
<td align="center" valign="top" style="color:#606060;font-family:Helvetica,Arial,sans-serif;font-size:11px;line-height:150%;padding-right:20px;padding-bottom:5px;padding-left:20px;text-align:center">
72+
$SENT_TO$ [Email]
73+
<br>
74+
<a href="$SIGNUP_LINK$" style="color:#404040!important" target="_blank">$SIGNUP$</a> · <a href="[unsubscribe]" style="color:#404040!important" target="_blank">$UNSUBSCRIBE$</a>
75+
<br>
76+
Hatnote · 558 N 3rd St. · San Jose, CA 95112 · USA
77+
<br>
78+
<br>
79+
80+
</td>
81+
</tr>
82+
</tbody></table>
83+
</td>
84+
</tr>
85+
</tbody>
86+
</table>
87+
6588
<!-- /body -->
6689

6790
</body>

weeklypedia/issue_templates/base/email.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,9 @@ $STATS_INTRO$:
4040
* $BOT_EDIT_COUNTS$
4141

4242
Learn more about the Weeklypedia Digest: http://weekly.hatnote.com/
43+
44+
This email was sent to [Email]
45+
46+
Unsubscribe: [unsubscribe]
47+
48+
Hatnote · 131 E Empire Street · San Jose, CA 95112 · USA

weeklypedia/issue_templates/template_archive_index.html

Lines changed: 40 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,46 @@
1212
<!-- end-email-exclude -->
1313
</head>
1414
<body>
15-
<div class="header">
16-
<h1><span><em>the</em> WEEKLYPEDIA</span> </h1>
17-
<p>A list of the most edited Wikipedia articles and discussions from the last week.</p>
18-
<p>Delivered every Friday by email.</p>
19-
</div>
20-
<div class="announce">
21-
<ul class="breadcrumb">
22-
<li><a href="../../index.html">Home</a></li>
23-
<li>{lang} edition archives</li>
24-
</ul>
25-
</div>
26-
<div class="main">
27-
<div class="content">
28-
<h2>{lang} Edition</h2>
29-
<p>If you want to stay up to date with the most active articles and discussions, please <a href="../../index.html">sign up for future issues</a>.</p>
30-
<ul class="buttons archive-list">
31-
{#issues}
32-
<li><a href="{path}">{date}</a></li>
33-
{/issues}
34-
</ul>
35-
<a href="{signup_url}" class="signup"><span>Sign up!</span></a>
36-
<div class="content">
37-
<h2>About</h2>
38-
<p>This project retrieves a list of the week's recent changes using <a href="http://tools.wmflabs.org/">Wikimedia Tool Labs</a>, and delivers emails using MailChimp. Code and more information <a href="https://github.com/hatnote/weeklypedia">available on GitHub</a>. Built by <a href="https://github.com/slaporte">Stephen LaPorte</a> and <a href="https://github.com/mahmoud">Mahmoud Hashemi</a>.</p>
39-
<p><a href="http://blog.hatnote.com/">Learn more on the Hatnote blog</a>.</p>
15+
<div class="container">
16+
<div class="header">
17+
<h1><span><em>the</em> WEEKLYPEDIA</span> </h1>
18+
<p>A list of the most edited Wikipedia articles and discussions from the last week.</p>
19+
<p>Delivered every Friday by email.</p>
20+
</div>
21+
<div class="announce">
22+
<ul class="breadcrumb">
23+
<li><a href="../../index.html">Home</a></li>
24+
<li>{lang} edition archives</li>
25+
</ul>
26+
</div>
27+
<div class="main">
28+
<div class="content">
29+
<h2>Sign up</h2>
30+
<p>If you want to stay up to date with the most active articles and discussions, please sign up for future issues.</p>
31+
32+
<form action="https://mailer.hatnote.com/s/subscribe" method="POST" accept-charset="utf-8">
33+
<label class="email-label" for="email">Email</label>
34+
<input class="email-input" type="email" name="email" id="email"/>
35+
<div style="display:none;">
36+
<label for="hp">HP</label><br/>
37+
<input type="text" name="hp" id="hp"/></div>
38+
<input type="hidden" name="list" value="{list_id}"/>
39+
<input type="hidden" name="subform" value="yes"/>
40+
<input class="sub-button" type="submit" name="submit" value="subscribe" id="submit"/>
41+
</form>
42+
43+
<h2>{lang} Archives</h2>
44+
45+
<ul class="buttons archive-list">
46+
{#issues}
47+
<li><a href="{path}">{date}</a></li>
48+
{/issues}
49+
</ul>
50+
<div class="content">
51+
<h2>About</h2>
52+
<p>This project retrieves a list of the week's recent changes using <a href="http://tools.wmflabs.org/">Wikimedia Tool Labs</a>, and delivers emails using MailChimp. Code and more information <a href="https://github.com/hatnote/weeklypedia">available on GitHub</a>. Built by <a href="https://github.com/slaporte">Stephen LaPorte</a> and <a href="https://github.com/mahmoud">Mahmoud Hashemi</a>.</p>
53+
<p><a href="http://blog.hatnote.com/">Learn more on the Hatnote blog</a>.</p>
54+
</div>
4055
</div>
4156
</div>
4257
<script>

0 commit comments

Comments
 (0)