Permalink
Browse files

When there is no title or no description, don't append it

  • Loading branch information...
1 parent e3a589f commit 45f797a2e07e1d5e9a0d18e29faf45f1f55e2af2 @fb55 committed Mar 9, 2012
Showing with 18 additions and 16 deletions.
  1. +18 −16 lib/index.js
View
34 lib/index.js
@@ -1,6 +1,6 @@
var minreq = require("minreq"),
url = require("url"),
- process = require("./process.js"),
+ proc = require("./process.js"),
mote = require("mote"),
readFileSync = require("fs").readFileSync,
feedStart = mote.compile(readFileSync(__dirname+"/../templates/01-info.xml")+""),
@@ -19,23 +19,25 @@ module.exports = function(options, response){
return;
}
- var feed = process.parseFeed(data);
+ var feed = proc.parseFeed(data);
response.writeHead(200, {"Content-Type": "application/rss+xml"});
- response.write(feedStart(feed));
-
- process.processFeed(feed, function(err, result, item){
- if(err) return; //just skip the element
-
- response.write(feedItem({
- title: options.replace_title === "on" ? result.title : item.title,
- link: result.link,
- description: options.append_result === "on" ? item.description + "<br/><hr/><br/>" + result.html : result.html,
- pubdate: item.pubDate,
- guid: item.id || item.link
- }));
- }, function(){ response.end(feedEnd); }, parseInt(options.item_num, 10));
+ response.write(feedStart(feed));
+
+ proc.processFeed(feed, function(err, result, item){
+ if(err) return; //just skip the element
+
+ response.write(feedItem({
+ title: options.replace_title === "on" && result.title
+ ? result.title : item.title,
+ link: result.link,
+ description: options.append_result === "on" && item.description
+ ? item.description + "<br/><hr/><br/>" + result.html : result.html,
+ pubdate: item.pubDate,
+ guid: item.id || item.link
+ }));
+ }, function(){ response.end(feedEnd); }, parseInt(options.item_num, 10));
});
};
-module.exports.process = process;
+module.exports.process = proc;

0 comments on commit 45f797a

Please sign in to comment.