New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hexo 3.3.1 #5

Open
wants to merge 1 commit into
base: master
from
Jump to file or symbol
Failed to load files and symbols.
+25 −13
Diff settings

Always

Just for now

View
@@ -1,10 +1,8 @@
(function() {
function generator(locals) {
var comparer, extractName, fileUtil, generateCategoriesJson, generatePostsJson, generateTagsJson, pathUtil;
pathUtil = require('path');
fileUtil = hexo.util.file2;
generatePostsJson = function(posts) {
var postsMeta;
postsMeta = {
@@ -16,7 +14,11 @@
};
})
};
return hexo.route.set('posts.json', JSON.stringify(postsMeta));
return {
path: 'posts.json',
data: JSON.stringify(postsMeta)
};
};
comparer = function(a, b) {
@@ -32,22 +34,32 @@
categoriesMeta = {
categories: categories.sort(comparer).map(extractName)
};
return hexo.route.set('categories.json', JSON.stringify(categoriesMeta));
return {
path: 'categories.json',
data: JSON.stringify(categoriesMeta)
};
};
generateTagsJson = function(tags) {
var tagsMeta;
tagsMeta = {
tags: tags.sort(comparer).map(extractName)
};
return hexo.route.set('tags.json', JSON.stringify(tagsMeta));
};
module.exports = function(locals, render, callback) {
generatePostsJson(locals.posts.toArray());
generateCategoriesJson(locals.categories.toArray());
generateTagsJson(locals.tags.toArray());
return callback();
return {
path: 'tags.json',
data: JSON.stringify(tagsMeta)
};
};
}).call(this);
var jsons = new Array();

This comment has been minimized.

@wafer-li

wafer-li Apr 9, 2017

This line may not be elegant.

Since I don't have much knowledge of JS, if there is any elegant way, please inform me.

@wafer-li

wafer-li Apr 9, 2017

This line may not be elegant.

Since I don't have much knowledge of JS, if there is any elegant way, please inform me.

jsons.push(generatePostsJson(locals.posts.toArray()));
jsons.push(generateCategoriesJson(locals.categories.toArray()));
jsons.push(generateTagsJson(locals.tags.toArray()));
return jsons;
}
module.exports = generator;
ProTip! Use n and p to navigate between commits in a pull request.