Navigation Menu

Skip to content

Commit

Permalink
Fixed rss example
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Sep 26, 2011
1 parent aa400f7 commit 0108344
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
13 changes: 7 additions & 6 deletions examples/rss.jade
@@ -1,13 +1,14 @@
!!! xml
doctype xml
rss(version='2.0')
channel
title RSS Title
description Some description here
link http://google.com
lastBuildDate Mon, 06 Sep 2010 00:01:00 +0000
pubDate Mon, 06 Sep 2009 16:45:00 +0000

item
title Example entry
description Description here
link http://google.com/foobar

each item in items
item
title= item.title
description= item.description
link= item.link
16 changes: 11 additions & 5 deletions examples/rss.js
Expand Up @@ -3,9 +3,15 @@
* Module dependencies.
*/

var jade = require('./../lib/jade');
var jade = require('./../')
, path = __dirname + '/rss.jade'
, str = require('fs').readFileSync(path, 'utf8')
, fn = jade.compile(str, { filename: path, pretty: true });

jade.renderFile(__dirname + '/rss.jade', function(err, xml){
if (err) throw err;
console.log(xml);
});
var items = [];

items.push({ title: 'Example', description: 'Something', link: 'http://google.com' });
items.push({ title: 'LearnBoost', description: 'Cool', link: 'http://learnboost.com' });
items.push({ title: 'Express', description: 'Cool', link: 'http://expressjs.com' });

console.log(fn({ items: items }));

0 comments on commit 0108344

Please sign in to comment.