docpad-plugin-yourpluginname
Version:
DocPad plugin that adds the ability to render Something to Something Else
32 lines (26 loc) • 972 B
JavaScript
// Generated by CoffeeScript 2.5.1
// Export Plugin
module.exports = function(BasePlugin) {
var YourpluginnamePlugin;
return YourpluginnamePlugin = (function() {
// Define Plugin
class YourpluginnamePlugin extends BasePlugin {
// Render
// Called per document, for each extension conversion. Used to render one extension to another.
render(opts) {
var file, inExtension, outExtension;
// Prepare
({inExtension, outExtension, file} = opts);
// Upper case the text document's content if it is using the convention txt.(uc|uppercase)
if ((inExtension === 'uc' || inExtension === 'uppercase') && (outExtension === 'txt' || outExtension === null)) {
// Render synchronously
opts.content = opts.content.toUpperCase();
}
}
};
// Plugin name
YourpluginnamePlugin.prototype.name = 'yourpluginname';
return YourpluginnamePlugin;
}).call(this);
};
// Done