Skip to content

Commit 4fa6e11

Browse files
committed
Use Mustache template for email
1 parent 5fee698 commit 4fa6e11

File tree

3 files changed

+24
-8
lines changed

3 files changed

+24
-8
lines changed

index.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ var email = require('emailjs');
66
var fs = require('fs');
77
var path = require('path');
88
var program = require('commander');
9+
const Mustache = require('mustache');
910
var scrawl = require('./www/scrawl');
1011
var Twitter = require('twitter');
1112
var wp = require('wordpress');
@@ -50,6 +51,17 @@ gDate = gDate.match(/([0-9]{4}-[0-9]{2}-[0-9]{2})/)[1];
5051
scrawl.group = 'JSON-LD CG Telecon';
5152
scrawl.people = JSON.parse(peopleJson);
5253

54+
const EMAIL_BODY = `Thanks to {{scribe}} for scribing this week! The minutes
55+
for this week's JSON-LD CG telecon are now available:
56+
57+
https://json-ld.github.io/minutes/{{gDate}}/
58+
59+
Full text of the discussion follows for W3C archival purposes.
60+
Audio from the meeting is available as well (link provided below).
61+
62+
----------------------------------------------------------------
63+
{{{content}}}`;
64+
5365
/************************* Utility Functions *********************************/
5466
function postToWordpress(username, password, content, callback) {
5567
var client = wp.createClient({
@@ -286,13 +298,7 @@ async.waterfall([ function(callback) {
286298
var content = scrawl.generateMinutes(gLogData, 'text', gDate, haveAudio);
287299
var scribe = content.match(/Scribe:\n\s(.*)\n/g)[0]
288300
.replace(/\n/g, '').replace('Scribe: ', '');
289-
content = 'Thanks to ' + scribe + ' for scribing this week! The minutes\n' +
290-
'for this week\'s JSON-LD CG telecon are now available:\n\n' +
291-
'https://json-ld.github.io/minutes/'+ gDate + '/\n\n' +
292-
'Full text of the discussion follows for W3C archival purposes.\n' +
293-
'Audio from the meeting is available as well (link provided below).\n\n' +
294-
'----------------------------------------------------------------\n' +
295-
content;
301+
content = Mustache.render(EMAIL_BODY, {scribe, gDate, content});
296302

297303
if(process.env.SCRAWL_EMAIL_USERNAME && process.env.SCRAWL_EMAIL_PASSWORD &&
298304
process.env.SCRAWL_EMAIL_SERVER) {

package-lock.json

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
"name": "scrawl",
33
"version": "0.4.0",
44
"description": "IRC log processing tool for scribes to assist in creating minutes for W3C group.",
5-
"keywords": ["IRC", "W3C", "minutes"],
5+
"keywords": [
6+
"IRC",
7+
"W3C",
8+
"minutes"
9+
],
610
"repository": {
711
"type": "git",
812
"url": "git@github.com:json-ld/scrawl.js.git"
@@ -21,6 +25,7 @@
2125
"mailparser": "~0.2.26",
2226
"mime": "^2.3.1",
2327
"moment": "~2.19.3",
28+
"mustache": "^2.3.0",
2429
"prompt": "^1.0.0",
2530
"twitter": "~0.2.5",
2631
"underscore": "~1.5.0",

0 commit comments

Comments
 (0)