From 010834448f45bcb1d5733b65de47666812260b32 Mon Sep 17 00:00:00 2001 From: Tj Holowaychuk Date: Mon, 26 Sep 2011 10:09:58 -0700 Subject: [PATCH] Fixed rss example --- examples/rss.jade | 13 +++++++------ examples/rss.js | 16 +++++++++++----- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/examples/rss.jade b/examples/rss.jade index 3f5f03ea5..165dffb0b 100644 --- a/examples/rss.jade +++ b/examples/rss.jade @@ -1,4 +1,4 @@ -!!! xml +doctype xml rss(version='2.0') channel title RSS Title @@ -6,8 +6,9 @@ channel 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 diff --git a/examples/rss.js b/examples/rss.js index caec85882..861986a3d 100644 --- a/examples/rss.js +++ b/examples/rss.js @@ -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); -}); \ No newline at end of file +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 })); \ No newline at end of file