Skip to content
This repository has been archived by the owner on Feb 17, 2021. It is now read-only.

Commit

Permalink
Merge pull request #57 from ft-interactive/rss-feed
Browse files Browse the repository at this point in the history
Encode HTML characters. Prettify XML
  • Loading branch information
Sumeet Adur committed Dec 22, 2015
2 parents 7f8b30f + f9157de commit e07e1fb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 10 additions & 1 deletion gulpfile.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import igdeploy from 'igdeploy';
import mkdirp from 'mkdirp';
import mergeStream from 'merge-stream';
import path from 'path';
import prettyData from 'gulp-pretty-data';
import runSequence from 'run-sequence';
import source from 'vinyl-source-stream';
import subdir from 'subdir';
Expand Down Expand Up @@ -402,10 +403,18 @@ gulp.task('create-rss-feed', ['download-data'], () => {
rssString += `<title>${words[word].word}</title>`;
rssString += `<link>http://ig.ft.com/sites/guffipedia/${words[word].slug}/</link>`;
rssString += `<guid>http://ig.ft.com/sites/guffipedia/${words[word].slug}/</guid>`;
rssString += `<description>${words[word].definition}</description>`;
if(words[word].definition) {
let descriptionTemplate = Handlebars.compile('{{definition}}');
let descriptionHtml = descriptionTemplate({definition: words[word].definition});
rssString += `<description>${descriptionHtml}</description>`;
}
rssString += '</item>';
}
rssString += '</channel></rss>';

fs.writeFileSync('rss.xml', rssString);

gulp.src('rss.xml')
.pipe(prettyData({type: 'prettify'}))
.pipe(gulp.dest('.'));
});
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"gulp-imagemin": "^2.4.0",
"gulp-minify-css": "^1.2.1",
"gulp-minify-html": "^1.0.4",
"gulp-pretty-data": "^0.1.1",
"gulp-rename": "^1.2.2",
"gulp-sass": "^2.1.0",
"gulp-scss-lint": "^0.3.8",
Expand Down

0 comments on commit e07e1fb

Please sign in to comment.