marked-brunch-static
Advanced tools
Comparing version 1.1.0 to 1.1.1
56
index.js
@@ -10,37 +10,41 @@ var MarkedBrunchStatic, _, marked; | ||
MarkedBrunchStatic = (function() { | ||
function MarkedBrunchStatic(config1) { | ||
var ref, ref1; | ||
this.config = config1; | ||
if ((ref = this.config) != null ? ref.fileMatch : void 0) { | ||
this.handles = this.config.fileMatch; | ||
delete this.config.fileMatch; | ||
class MarkedBrunchStatic { | ||
constructor(config1) { | ||
var ref, ref1; | ||
this.config = config1; | ||
if ((ref = this.config) != null ? ref.fileMatch : void 0) { | ||
this.handles = this.config.fileMatch; | ||
delete this.config.fileMatch; | ||
} | ||
if ((ref1 = this.config) != null ? ref1.fileTransform : void 0) { | ||
this.transformPath = this.config.fileTransform; | ||
delete this.config.fileTransform; | ||
} | ||
} | ||
if ((ref1 = this.config) != null ? ref1.fileTransform : void 0) { | ||
this.transformPath = this.config.fileTransform; | ||
delete this.config.fileTransform; | ||
transformPath(filename) { | ||
return filename.replace(/\.static\.\w+$/, '.html'); | ||
} | ||
} | ||
MarkedBrunchStatic.prototype.handles = /\.static\.(?:markdown|mdown|mkdn|md|mkd|mdwn|mdtxt|mdtext|text)$/; | ||
compile(data, filename, options, callback) { | ||
var opts; | ||
opts = _.merge({}, this.config, options != null ? options.markdown : void 0); | ||
return marked(data, opts, function(err, content) { | ||
if (err) { | ||
callback(err); | ||
return; | ||
} | ||
// we need to fix some html-escaping that breaks handlebars | ||
content = content.replace(/\{\{>/g, '{{>'); | ||
return callback(null, content); | ||
}); | ||
} | ||
MarkedBrunchStatic.prototype.transformPath = function(filename) { | ||
return filename.replace(/\.static\.\w+$/, '.html'); | ||
}; | ||
MarkedBrunchStatic.prototype.compile = function(data, filename, options, callback) { | ||
var opts; | ||
opts = _.merge({}, this.config, options != null ? options.markdown : void 0); | ||
return marked(data, opts, function(err, content) { | ||
if (err) { | ||
callback(err); | ||
return; | ||
} | ||
content = content.replace(/\{\{>/g, '{{>'); | ||
return callback(null, content); | ||
}); | ||
}; | ||
MarkedBrunchStatic.prototype.handles = /\.static\.(?:markdown|mdown|mkdn|md|mkd|mdwn|mdtxt|mdtext|text)$/; | ||
return MarkedBrunchStatic; | ||
})(); | ||
}).call(this); | ||
@@ -47,0 +51,0 @@ module.exports = function(config) { |
@@ -11,3 +11,3 @@ { | ||
], | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"homepage": "https://github.com/bmatcuk/marked-brunch-static", | ||
@@ -20,17 +20,13 @@ "license": "MIT", | ||
"scripts": { | ||
"prepublish": "brunch build -P", | ||
"start": "brunch watch", | ||
"test": "mocha" | ||
"prepare": "brunch build -p", | ||
"start": "brunch watch" | ||
}, | ||
"dependencies": { | ||
"lodash.merge": "^3.3.2", | ||
"marked": "^0.3.5" | ||
"lodash.merge": "^4.6.1", | ||
"marked": "^0.5.2" | ||
}, | ||
"devDependencies": { | ||
"brunch": "^1.8.5", | ||
"chai": "^3.2.0", | ||
"coffee-script-brunch": "^1.8.2", | ||
"javascript-brunch": "^1.7.1", | ||
"mocha": "^2.3.0" | ||
"brunch": "~2.10.17", | ||
"coffee-script-brunch": "~3.0.0" | ||
} | ||
} |
@@ -39,2 +39,3 @@ ![Release](https://img.shields.io/npm/v/marked-brunch-static.svg) | ||
fileMatch: ... | ||
fileTransform: ((filename) -> ...) | ||
... | ||
@@ -53,1 +54,5 @@ } | ||
* **fileTransform** _(default: `(filename) -> filename.replace(/\.static\.\w+$/, '.html')`)_ | ||
> _fileTransform_ converts the input filename into an html filename. It takes a filename as input and returns the new filename with the html extension. If you set the _fileMatch_ property above, you'll probably need to set this option as well to ensure that your output files end with the html extension. | ||
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7060
2
42
57
6
+ Addedlodash.merge@4.6.2(transitive)
+ Addedmarked@0.5.2(transitive)
- Removedlodash._arraycopy@3.0.0(transitive)
- Removedlodash._arrayeach@3.0.0(transitive)
- Removedlodash._basecopy@3.0.1(transitive)
- Removedlodash._basefor@3.0.3(transitive)
- Removedlodash._bindcallback@3.0.1(transitive)
- Removedlodash._createassigner@3.1.1(transitive)
- Removedlodash._getnative@3.9.1(transitive)
- Removedlodash._isiterateecall@3.0.9(transitive)
- Removedlodash.isarguments@3.1.0(transitive)
- Removedlodash.isarray@3.0.4(transitive)
- Removedlodash.isplainobject@3.2.0(transitive)
- Removedlodash.istypedarray@3.0.6(transitive)
- Removedlodash.keys@3.1.2(transitive)
- Removedlodash.keysin@3.0.8(transitive)
- Removedlodash.merge@3.3.2(transitive)
- Removedlodash.restparam@3.6.1(transitive)
- Removedlodash.toplainobject@3.0.0(transitive)
- Removedmarked@0.3.19(transitive)
Updatedlodash.merge@^4.6.1
Updatedmarked@^0.5.2