You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.6 KiB
49 lines
1.6 KiB
// Generated by CoffeeScript 1.4.0
|
|
var __hasProp = {}.hasOwnProperty,
|
|
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
|
|
|
module.exports = function(BasePlugin) {
|
|
var Html2coffeePlugin;
|
|
return Html2coffeePlugin = (function(_super) {
|
|
|
|
__extends(Html2coffeePlugin, _super);
|
|
|
|
function Html2coffeePlugin() {
|
|
return Html2coffeePlugin.__super__.constructor.apply(this, arguments);
|
|
}
|
|
|
|
Html2coffeePlugin.prototype.name = 'html2coffee';
|
|
|
|
Html2coffeePlugin.prototype.renderHTMLToCoffee = function(opts, next) {
|
|
var content, html2coffee, outputStream, templateData;
|
|
templateData = opts.templateData, content = opts.content;
|
|
html2coffee = require('html2coffeekup');
|
|
outputStream = {
|
|
content: '',
|
|
write: function(data) {
|
|
return this.content += data;
|
|
}
|
|
};
|
|
return html2coffee.convert(content, outputStream, function(err) {
|
|
if (err) {
|
|
return next(err);
|
|
}
|
|
opts.content = outputStream.content;
|
|
return next();
|
|
});
|
|
};
|
|
|
|
Html2coffeePlugin.prototype.render = function(opts, next) {
|
|
var inExtension, outExtension;
|
|
inExtension = opts.inExtension, outExtension = opts.outExtension;
|
|
if (inExtension === 'html' && outExtension === 'coffee') {
|
|
return this.renderHTMLToCoffee(opts, next);
|
|
} else {
|
|
return next();
|
|
}
|
|
};
|
|
|
|
return Html2coffeePlugin;
|
|
|
|
})(BasePlugin);
|
|
};
|