Content-Length: 554339 | pFad | http://github.com/mtabini/louis/commit/7f0735230f27750dc6fc4cfcbeb3b86349ce8008

79 - Bug fixes · mtabini/louis@7f07352 · GitHub
Skip to content

Commit

Permalink
- Bug fixes
Browse files Browse the repository at this point in the history
- New theme
  • Loading branch information
mtabini committed Jul 8, 2013
1 parent 1fb70cb commit 7f07352
Show file tree
Hide file tree
Showing 26 changed files with 1,402 additions and 34 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
node_modules
node_modules
.sass-cache
.DS_Store
27 changes: 18 additions & 9 deletions lib/models/archive/compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,35 @@ function setupCompile(Archive) {
var stream = mustache.compileAndRender(
_this.site.config.templates.archive,
{
site: _this.site,
archive: section,
prev: prev,
next: next
}
);

result = '';
var result = '';
var hadError = false;

stream.on('data', function(data) {
result += data.toString();
});

stream.on('error', function(err) {
hadError = true;
callback(err);
});

stream.on('end', function() {
callback(
null,
{
link: section.link,
compiled: result
}
);
if (!hadError) {
callback(
null,
{
link: section.link,
compiled: result
}
);
}
});
},

Expand Down Expand Up @@ -87,7 +96,7 @@ function setupCompile(Archive) {
this.sectionPointers.push({
title: date.format('MMM YYYY'),
longTitle: date.format('MMMM YYYY'),
link: '/archive/' + year + '-' + month,
link: '/archive/' + year + '-' + month + '.html',
pages: this.sections[year][month]
});
}, this);
Expand Down
10 changes: 9 additions & 1 deletion lib/models/archive/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,20 @@ function setupDeploy(Archive) {
fs.mkdir(destinationDir, callback);
},

function renderIndexPage(callback) {
if (_this.compiled.length > 0) {
fs.writeFile(_this.destinationPath('index.html'), _this.compiled[0].compiled, callback);
} else {
callback();
}
},

function renderAllPages(callback) {
async.each(
_this.compiled,

function iterator(compiled, callback) {
fs.writeFile(_this.destinationPath(path.basename(compiled.link) + '.html'), compiled.compiled, callback);
fs.writeFile(_this.destinationPath(path.basename(compiled.link)), compiled.compiled, callback);
},

callback
Expand Down
16 changes: 13 additions & 3 deletions lib/models/indexPage/compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ function setupCompile(IndexPage) {

IndexPage.prototype.compile = function compileIndexPage(callback) {
this.emit('willCompile', this);

var view = {
site: this.site,
page: this,
archive: this.site.postArchive.pages.all.slice(0, this.site.config.index.postCount),
posts: this.site.postArchive.pages.all.slice(0, this.site.config.index.postCount),
archive: this.site.postArchive.sectionPointers
};

mustache.root = this.site.path('/theme/templates');
Expand All @@ -16,15 +18,23 @@ function setupCompile(IndexPage) {
this.compiled = '';

var _this = this;
var hadError = false;

stream.on('data', function(data) {
_this.compiled += data.toString();
});

stream.on('error', function(err) {
hadError = true;
callback(err);
});

stream.on('end', function() {
_this.emit('didCompile', _this);

callback();
if (!hadError) {
callback();
}
});
};

Expand Down
18 changes: 16 additions & 2 deletions lib/models/page/compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,15 @@ function setupCompile(Page) {
fs.readFile(_this.path('document.md'), function(err, source) {
if (err) return callback(err);

callback(null, markdown.convert(source.toString()));
_this.content = markdown.convert(source.toString());

callback(null, _this.content);
});
},

function compileTemplate(content, callback) {
var view = {
site: _this.site,
page: _this,
content: content
};
Expand All @@ -41,12 +44,23 @@ function setupCompile(Page) {
var stream = mustache.compileAndRender(templatePath, view);

_this.compiled = '';

var hadError = false;

stream.on('data', function(data) {
_this.compiled += data.toString();
});

stream.on('error', function(err) {
hadError = true;
callback(err);
});

stream.on('end', callback);
stream.on('end', function() {
if (!hadError) {
callback();
}
});
}

],
Expand Down
1 change: 1 addition & 0 deletions lib/models/page/init/template/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
title: {{title}}
author: {{author}}
dek: Provide a short introductory paragraph. Text only.

slug: {{slug}}

Expand Down
8 changes: 4 additions & 4 deletions lib/models/site/analyze.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ function setupAnalyze(Site) {
_this.loadArchives(force, callback);
},

function compileIndexPage(callback) {
_this.indexPage.compile(callback);
},

function compileArchivePage(callback) {
_this.postArchive.compile(callback);
},

function compileIndexPage(callback) {
_this.indexPage.compile(callback);
},

function compileFeed(callback) {
_this.emit('willCompileFeed', this);

Expand Down
8 changes: 4 additions & 4 deletions lib/models/site/init/template/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ feed:
site_url: http://example.com
image_url: http://example.com/icon.png
docs: http://example.com/rss/docs.html
author: Dylan Greene
managingEditor: Dylan Greene
webMaster: Dylan Greene
copyright: 2013 Dylan Greene
author: Robert Louis Stevenson
managingEditor: Robert Louis Stevenson
webMaster: Robert Louis Stevenson
copyright: 2013 Robert Louis Stevenson
language: en
categories:
- Category 1
Expand Down
Loading

0 comments on commit 7f07352

Please sign in to comment.








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/mtabini/louis/commit/7f0735230f27750dc6fc4cfcbeb3b86349ce8008

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy