Updated jobs-local to generate html
This commit is contained in:
parent
9f81e18182
commit
d014b4be86
@ -1,4 +1,10 @@
|
|||||||
var RssBraider = require('rss-braider'), fs = require('fs'),
|
var outputFile = 'jobs-local',
|
||||||
|
RssBraider = require('rss-braider'),
|
||||||
|
fs = require('fs'),
|
||||||
|
ejs = require('ejs'),
|
||||||
|
read = require('fs').readFileSync,
|
||||||
|
join = require('path').join,
|
||||||
|
str = read(join(__dirname, '/templates/rss.ejs'), 'utf8'),
|
||||||
feeds = {};
|
feeds = {};
|
||||||
|
|
||||||
// Pull feeds from config files:
|
// Pull feeds from config files:
|
||||||
@ -192,28 +198,43 @@ feeds.simple_test_feed = {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
var braider_options = {
|
var braider_options = {
|
||||||
feeds : feeds,
|
feeds: feeds,
|
||||||
indent : " ",
|
indent: " ",
|
||||||
date_sort_order : "desc", // Newest first
|
date_sort_order: "desc", // Newest first
|
||||||
log_level : "warn",
|
log_level: "warn",
|
||||||
plugins_directories : [__dirname + "/plugins/"],
|
dedupe_fields: ['link', 'guid']
|
||||||
dedupe_fields : ['link','guid']
|
|
||||||
};
|
};
|
||||||
var rss_braider = RssBraider.createClient(braider_options);
|
var rss_braider = RssBraider.createClient(braider_options);
|
||||||
|
|
||||||
// Override logging level (debug, info, warn, err, off)
|
// Override logging level (debug, info, warn, err, off)
|
||||||
rss_braider.logger.level('off');
|
rss_braider.logger.level('off');
|
||||||
|
|
||||||
// Output braided feed as rss. use 'json' for JSON output.
|
rss_braider.processFeed('simple_test_feed', 'json', function (err, data) {
|
||||||
rss_braider.processFeed('simple_test_feed', 'rss', function(err, data){
|
|
||||||
// rss_braider.processFeed('simple_test_feed', 'json', function(err, data){
|
|
||||||
if (err) {
|
if (err) {
|
||||||
return console.log(err);
|
return console.log(err);
|
||||||
}
|
}
|
||||||
// console.log(data);
|
|
||||||
fs.writeFile(__dirname + "/html/jobs-local.xml", data, function(err) {
|
var j = JSON.parse(data);
|
||||||
if(err) {
|
var ejsOutput = ejs.compile(str)(j);
|
||||||
|
|
||||||
|
fs.writeFile(__dirname + "/html/" + outputFile + ".html", ejsOutput, function (err) {
|
||||||
|
|
||||||
|
if (err) {
|
||||||
|
return console.log(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("The file was saved!");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
rss_braider.processFeed('simple_test_feed', 'rss', function (err, data) {
|
||||||
|
if (err) {
|
||||||
|
return console.log(err);
|
||||||
|
}
|
||||||
|
fs.writeFile(__dirname + "/html/" + outputFile + ".xml", data, function (err) {
|
||||||
|
if (err) {
|
||||||
return console.log(err);
|
return console.log(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user