grunt-pages
Advanced tools
Comparing version 0.10.1 to 0.11.0
{ | ||
"name": "grunt-pages", | ||
"version": "0.10.1", | ||
"version": "0.11.0", | ||
"description": "Grunt task to create pages using markdown and templates", | ||
"main": "Gruntfile.js", | ||
"dependencies": { | ||
"jade": "~0.35.0", | ||
"jade": "~1.0.0", | ||
"ejs": "~0.8.4", | ||
"colors": "~0.6.0-1", | ||
"pygmentize-bundled": "~2.1.0", | ||
"marked": "git://github.com/ChrisWren/marked.git#listener", | ||
"marked": "~0.3.0", | ||
"rss": "~0.2.0", | ||
"lodash": "~2.4.1", | ||
"node-fs": "~0.1.7" | ||
"node-fs": "~0.1.7", | ||
"handlebars": "~1.3.0" | ||
}, | ||
@@ -31,3 +32,4 @@ "devDependencies": { | ||
"grunt-node-inspector": "~0.1.0", | ||
"grunt-shell": "~0.4.0" | ||
"grunt-shell": "~0.4.0", | ||
"q": "~0.9.7" | ||
}, | ||
@@ -34,0 +36,0 @@ "peerDependencies": { |
@@ -378,2 +378,4 @@ # grunt-pages | ||
**0.10.1** - [`url`](#url) can now be specified as a function to allow for foreign language post titles and to support legacy URLs for those migrating to grunt-pages from another static site tool. | ||
**0.10.0** - Added [`options.rss.numPosts`](#rssnumposts) option to determine the number of posts included in the RSS feed, defaulting to 10. Header links now use the same URL formatting function as post URLs. | ||
@@ -380,0 +382,0 @@ |
@@ -29,2 +29,18 @@ /* | ||
extensions: ['.jade'] | ||
}, | ||
handlebars: { | ||
engine: require('handlebars'), | ||
extensions: ['.hbs', '.handlebars'], | ||
pregenerate: function (grunt, templateEngine, options) { | ||
if (options.partials) { | ||
var files = grunt.file.expand(options.partials); | ||
files.forEach(function (file) { | ||
var partialString = grunt.file.read(file); | ||
var name = path.basename(file, path.extname(file)); | ||
templateEngine.registerPartial(name,partialString); | ||
}.bind(this)); | ||
} | ||
} | ||
} | ||
@@ -48,2 +64,3 @@ }; | ||
var templateEngine; | ||
var engineOptions; | ||
@@ -139,14 +156,32 @@ // Declare a global function to format URLs that is available to all library methods | ||
var renderer = _.extend(new marked.Renderer(), { | ||
// Override heading rendering to embed anchor tag and icon span | ||
heading: function (text, level) { | ||
return '<h' + level + '><a name="' + | ||
formatPostUrl(text) + | ||
'" class="anchor" href="#' + | ||
formatPostUrl(text) + | ||
'"><span class="header-link"></span></a>' + | ||
text + '</h' + level + '>'; | ||
} | ||
}); | ||
var customMarkedOptions; | ||
if (options.markedOptions) { | ||
if (typeof options.markedOptions === 'function') { | ||
customMarkedOptions = options.markedOptions(marked); | ||
} else { | ||
customMarkedOptions = options.markedOptions; | ||
} | ||
} else { | ||
customMarkedOptions = {}; | ||
} | ||
// Parse post using [marked](https://github.com/chjj/marked) | ||
marked(post.markdown, { | ||
on: _.extend({ | ||
heading: function (token, callback) { | ||
callback(null, '<a name="' + | ||
formatPostUrl(token.text) + | ||
'" class="anchor" href="#' + | ||
formatPostUrl(token.text) + | ||
'"><span class="header-link"></span></a>' + | ||
token.text); | ||
} | ||
}, options.listeners || {}), | ||
marked(post.markdown, _.extend({ | ||
renderer: renderer, | ||
gfm: true, | ||
anchors: true, | ||
highlight: function (code, lang, callback) { | ||
@@ -158,6 +193,4 @@ | ||
}); | ||
}, | ||
gfm: true, | ||
anchors: true | ||
}, function (err, content) { | ||
} | ||
}, customMarkedOptions), function (err, content) { | ||
if (err) throw err; | ||
@@ -304,5 +337,6 @@ | ||
lib.setTemplateEngine = function () { | ||
templateEngine = _.find(templateEngines, function (engine) { | ||
engineOptions = _.find(templateEngines, function (engine) { | ||
return _.contains(engine.extensions, path.extname(_this.data.layout).toLowerCase()); | ||
}).engine; | ||
}); | ||
templateEngine = engineOptions.engine; | ||
}; | ||
@@ -348,2 +382,6 @@ | ||
if (engineOptions.pregenerate) { | ||
engineOptions.pregenerate.call(this, grunt, templateEngine, options); | ||
} | ||
lib.generatePosts(templateData); | ||
@@ -705,4 +743,4 @@ | ||
if (!options.rss.author) { | ||
grunt.fail.fatal('options.rss.author is required'); | ||
if (!options.rss.description) { | ||
grunt.fail.fatal('options.rss.description is required'); | ||
} | ||
@@ -709,0 +747,0 @@ |
Git dependency
Supply chain riskContains a dependency which resolves to a remote git URL. Dependencies fetched from git URLs are not immutable and can be used to inject untrusted code or reduce the likelihood of a reproducible install.
Found 1 instance in 1 package
50356
695
469
0
10
16
+ Addedhandlebars@~1.3.0
+ Addedhandlebars@1.3.0(transitive)
+ Addedjade@1.0.2(transitive)
+ Addedmarked@0.3.19(transitive)
+ Addeduglify-js@2.3.6(transitive)
+ Addedwith@2.0.0(transitive)
- Removedjade@0.35.0(transitive)
- Removedsource-map@0.1.43(transitive)
- Removedwith@1.1.1(transitive)
Updatedjade@~1.0.0
Updatedmarked@~0.3.0