Permalink
Browse files

Fixed rss example

  • Loading branch information...
1 parent aa400f7 commit 010834448f45bcb1d5733b65de47666812260b32 @tj tj committed Sep 26, 2011
Showing with 18 additions and 11 deletions.
  1. +7 −6 examples/rss.jade
  2. +11 −5 examples/rss.js
View
@@ -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
View
@@ -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.