Skip to content

Commit

Permalink
fix pages going into blog:dates
Browse files Browse the repository at this point in the history
  • Loading branch information
ProjectMoon committed Aug 21, 2011
1 parent 58d120f commit da5086e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
15 changes: 10 additions & 5 deletions lib/reed.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ function redisInsert(key, date, processedData, post, callback) {
});
}

function redisPageInsert(key, date, processedData, post, callback) {
processedData = JSON.stringify(processedData);
client.hset(key, "metadata", processedData, function() {
client.hset(key, "post", post, callback);
});
}

//taken from wheat -- MIT license
function preProcess(markdown) {
if (!(typeof markdown === 'string')) {
Expand Down Expand Up @@ -122,7 +129,7 @@ function loadPageFromFilesystem(filename, callback) {
var postDate = fs.statSync(filename).mtime.getTime();
metadata.lastModified = postDate;

redisInsert("page:" + filename, postDate, metadata, post, function() {
redisPageInsert("page:" + filename, postDate, metadata, post, function() {
if (watched[filename] !== true) {
reed.emit("addPage", metadata, post);
}
Expand Down Expand Up @@ -286,7 +293,6 @@ function pagesReadyCheck(fn, args) {
}
}


reed.getMetadata = function(title, callback) {
//convert to key/filename
var filename = toFilename(title);
Expand Down Expand Up @@ -419,10 +425,10 @@ reed.removeAll = function removeAll(callback) {
funcs.push(delegate("blog:dates"));

async.waterfall(funcs, function(err) {
if (!err) {
if (!err && typeof callback !== 'undefined') {
callback(null);
}
else {
else if (typeof callback !== 'undefined') {
callback(err);
}
});
Expand Down Expand Up @@ -487,7 +493,6 @@ reed.pages.open = function(directory) {
}

reed.pages.get = function getPage(title, callback) {
console.log('derp');
if (!pagesReadyCheck(getPage, arguments)) return;

//convert to key/filename
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"email": "rei@thermetics.net",
"description": "Redis + markdown blogging/website core",
"tags": [ "redis", "blog" ],
"version": "0.9",
"version": "0.9.0",
"homepage": "http://www.agnos.is/",
"repository": {
"type": "git",
Expand Down

0 comments on commit da5086e

Please sign in to comment.