New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

grunt-pages

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-pages - npm Package Compare versions

Comparing version 0.8.2 to 0.8.3

4

package.json
{
"name": "grunt-pages",
"version": "0.8.2",
"version": "0.8.3",
"description": "Grunt task to create pages using markdown and templates",

@@ -13,3 +13,3 @@ "main": "Gruntfile.js",

"rss": "~0.2.0",
"lodash": "~2.1.0"
"lodash": "~2.2.0"
},

@@ -16,0 +16,0 @@ "devDependencies": {

@@ -92,3 +92,3 @@ # grunt-pages

**Note: you can run grunt-pages with the --debug flag set to see all the data passed to templates for rendering**
**Note: you can run grunt-pages with the `--debug` flag set to see all the data passed to templates for rendering**

@@ -355,2 +355,4 @@ #### url

**0.8.2** - Temporarily reverted bug fix as caching issues resulted from code change.
**0.8.1** - Fixed bug where draft posts in nested folders weren't ignored properly.

@@ -357,0 +359,0 @@

@@ -21,4 +21,10 @@ /*

var templateEngines = {
ejs: require('ejs'),
jade: require('jade')
ejs: {
engine: require('ejs'),
extensions: ['.ejs']
},
jade: {
engine: require('jade'),
extensions: ['.jade']
}
};

@@ -71,5 +77,3 @@

}, [
'**',
'!_**',
'!.**'
'**'
]).length;

@@ -94,8 +98,15 @@

// Don't include draft posts or dotfiles
if (path.basename(postpath).indexOf('_') === 0 ||
path.basename(postpath).indexOf('.') === 0) {
// Don't include draft posts
if (path.basename(postpath).indexOf('_') === 0) {
if (++parsedPosts === numPosts) {
lib.renderPostsAndPages(postCollection, cacheFile, done);
}
return;
}
// Don't include dotfiles
if (path.basename(postpath).indexOf('.') === 0) {
return;
}
var post = lib.parsePostData(postpath);

@@ -116,3 +127,3 @@

on: _.extend({
heading : function (token, callback) {
heading: function (token, callback) {
callback(null, '<a name="' +

@@ -204,3 +215,4 @@ token.text.toLowerCase().replace(/[^\w]+/g, '-') +

if (fileString.indexOf('{') < fileString.indexOf('}')) {
if (fileString.indexOf('{') >= 0 &&
fileString.indexOf('{') < fileString.indexOf('}')) {
metaDataStart = fileString.indexOf('{');

@@ -219,3 +231,8 @@ } else {

postData = eval('(' + fileString.substr(metaDataStart, metaDataEnd) + ')');
postData.date = new Date(postData.date);
if (postData.date) {
postData.date = new Date(postData.date);
} else {
postData.date = new Date(fs.statSync(postPath).mtime);
}
postData.markdown = fileString.slice(metaDataEnd);

@@ -265,3 +282,3 @@ return postData;

} else {
grunt.fail.fatal('options.data format not recognized. Must be an Object or String.');
grunt.fail.fatal('`options.data` format not recognized. Must be an Object or String.');
}

@@ -271,2 +288,11 @@ };

/**
* Determines the template engine based on the `layout`'s file extension
*/
lib.setTemplateEngine = function () {
templateEngine = _.find(templateEngines, function (engine) {
return _.contains(engine.extensions, path.extname(_this.data.layout).toLowerCase());
}).engine;
};
/**
* Renders posts and pages once all posts have been parsed

@@ -280,2 +306,4 @@ * @param {Array} postCollection Collection of parsed posts with the content and metadata properties

lib.setTemplateEngine();
if (options.data) {

@@ -454,6 +482,2 @@ lib.setData(templateData);

lib.generatePosts = function (templateData) {
// Determine the template engine based on the file's extension name
templateEngine = templateEngines[path.extname(_this.data.layout).slice(1).toLowerCase()];
var layoutString = fs.readFileSync(_this.data.layout, 'utf8');

@@ -681,2 +705,6 @@ var fn = templateEngine.compile(layoutString, { pretty: true, filename: _this.data.layout });

if (!fs.existsSync(listPage)) {
return grunt.fail.fatal('No `options.pagination.listPage` found at ' + listPage);
}
// If the pageSrc option is used, generate list pages relative to options.pageSrc

@@ -688,3 +716,3 @@ // Otherwise, generate list pages relative to the root of the destination folder

} else {
grunt.fail.fatal('The pagination.listPage must be within the options.pageSrc directory.');
return grunt.fail.fatal('The `options.pagination.listPage` must be within the options.pageSrc directory.');
}

@@ -706,3 +734,3 @@ }

if (urlFormat.indexOf(':id') === -1) {
grunt.fail.fatal('The pagination.url property must include an \':id\' variable which is replaced by the list page\'s identifier.');
return grunt.fail.fatal('The `options.pagination.url` must include an \':id\' variable which is replaced by the list page\'s identifier.');
}

@@ -709,0 +737,0 @@ if (options.pageSrc) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc