Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' into config

  • Loading branch information...
commit c54a70e5dbc0791e482ce550b8ddfccc11386218 2 parents 64a61fb + 32676fa
@wlaurance wlaurance authored
Showing with 23 additions and 3 deletions.
  1. +7 −2 lib/glog.js
  2. +16 −1 test/glog_tests.js
View
9 lib/glog.js
@@ -175,6 +175,7 @@ Glog.prototype.load_articles = function(options, cb) {
if(month < 10) {
month = ['0', month].join('');
}
+ var show_on_home_page = header.show_on_home_page != null ? header.show_on_home_page : true;
articles.push({
'title' : header.title,
@@ -184,7 +185,8 @@ Glog.prototype.load_articles = function(options, cb) {
'year' : year,
'month' : month,
'body' : body,
- 'url' : [year, month, (header.url || header.title.replace(/\s/g, '-'))].join('/')
+ 'url' : [year, month, (header.url || header.title.replace(/\s/g, '-'))].join('/'),
+ 'show_on_home_page': show_on_home_page
});
if (files.length === articles.length && (fn.articlePostPlugins.length > 1 || fn.articlePrePlugins.length > 1)){
var plugins = [];
@@ -210,7 +212,7 @@ Glog.prototype.load_articles = function(options, cb) {
plugins.push(fn.articlePrePlugins[p]);
}
}
- if(fn.articlePostPlugins.length > 1){
+ if(postlength > 1){
if(prelength > 1){
fn.articlePostPlugins[0] = function(result, wcb){
for(var k in result){
@@ -220,6 +222,9 @@ Glog.prototype.load_articles = function(options, cb) {
}
} else {
fn.articlePostPlugins[0] = function(wcb){
+ for(var k in articles){
+ articles[k].body = marked(articles[k].body);
+ }
wcb(null, articles);
};
}
View
17 test/glog_tests.js
@@ -48,7 +48,7 @@ describe('Glog', function() {
glog.load_configs(function(options) {
glog.load_plugins(options, function(err) {
glog.load_articles(options, function(articles) {
- assert.equal(articles.length, 2);
+ assert.equal(articles.length, 3);
done();
});
});
@@ -83,6 +83,21 @@ describe('Glog', function() {
});
});
+ it('default to show on home page', function(done) {
+ var glog = require('../lib/glog');
+ glog.load_configs(function(options) {
+ glog.load_plugins(options, function(){
+ glog.load_articles(options, function(articles) {
+ glog.render_blog(options, articles, function() {
+ assert.equal(articles[0].show_on_home_page, false);
+ assert.equal(articles[1].show_on_home_page, true);
+ done();
+ });
+ });
+ });
+ });
+
+ });
});
Please sign in to comment.
Something went wrong with that request. Please try again.