diff --git a/client/definition-page.hbs b/client/definition-page.hbs
index dfd523e..27cfe73 100755
--- a/client/definition-page.hbs
+++ b/client/definition-page.hbs
@@ -49,7 +49,7 @@
{{#if previousWord}}
diff --git a/gulpfile.babel.js b/gulpfile.babel.js
index 1470019..8b2b778 100755
--- a/gulpfile.babel.js
+++ b/gulpfile.babel.js
@@ -296,8 +296,9 @@ gulp.task('download-data', () => fetch(SPREADSHEET_URL)
for (const row of spreadsheet) {
let currentSlug = slugify(row.word);
+ let currentWord = words[currentSlug];
- words[currentSlug].relatedwords = words[currentSlug].relatedwords.map(relatedWord => ({
+ currentWord.relatedwords = currentWord.relatedwords.map(relatedWord => ({
slug: slugify(relatedWord),
word: words[slugify(relatedWord)].word
}));
@@ -310,7 +311,7 @@ gulp.task('download-data', () => fetch(SPREADSHEET_URL)
slugPointer = slugIndex.length - 1;
}
- words[currentSlug].previousWord = {
+ currentWord.previousWord = {
slug: words[slugIndex[slugPointer]].slug,
word: words[slugIndex[slugPointer]].word
};
@@ -321,20 +322,24 @@ gulp.task('download-data', () => fetch(SPREADSHEET_URL)
slugPointer = 0;
}
- words[currentSlug].nextWord = {
+ currentWord.nextWord = {
slug: words[slugIndex[slugPointer]].slug,
word: words[slugIndex[slugPointer]].word
};
- words[currentSlug].showPerpetratorData = words[currentSlug].perpetrator
- || words[currentSlug].usagesource ? true : null;
- if(words[currentSlug].wordid) {
- words[currentSlug].wordid = words[currentSlug].wordid.substring(4,words[currentSlug].wordid.length);
+ currentWord.showPerpetratorData = currentWord.perpetrator
+ || currentWord.usagesource ? true : null;
+ if(currentWord.wordid) {
+ currentWord.wordid = currentWord.wordid.substring(4,currentWord.wordid.length);
}
- let date = new Date(words[currentSlug].submissiondate);
+ let date = new Date(currentWord.submissiondate);
+ currentWord.formatteddate = monthNames[date.getMonth()] + " " + date.getDate() + ", " + date.getFullYear();
- words[currentSlug].formatteddate = monthNames[date.getMonth()] + " " + date.getDate() + ", " + date.getFullYear();
+ const tweetTextString = `“${currentWord.word}”: Corporate language crime no. ${currentWord.wordid} https://ig.ft.com/sites/guffipedia/${currentSlug}`;
+ const tweetTextRSSTemplate = Handlebars.compile('{{tweetText}}');
+ currentWord.tweettextrss = tweetTextRSSTemplate({tweetText: tweetTextString});
+ currentWord.tweettexturi = encodeURI(tweetTextString);
}
fs.writeFileSync('client/words.json', JSON.stringify(sortedWords, null, 2));
@@ -407,15 +412,10 @@ gulp.task('create-rss-feed', () => {
});
let rssString = `
${rssTitle}${rssLink}${rssDescription}`;
- for (const word of dateIndex) {
+ for (const slug of dateIndex) {
+ let currentWord = words[slug];
rssString += '- ';
- rssString += `${words[word].word}`;
- rssString += `http://ig.ft.com/sites/guffipedia/${words[word].slug}/`;
- rssString += `http://ig.ft.com/sites/guffipedia/${words[word].slug}/`;
- if(words[word].definition) {
- let description = Handlebars.compile('{{definition}}', {definition: words[word].definition});
- rssString += `${description}`;
- }
+ rssString += `${currentWord.word}http://ig.ft.com/sites/guffipedia/${slug}/http://ig.ft.com/sites/guffipedia/${slug}/${currentWord.tweettextrss}`;
rssString += '
';
}
rssString += '';