Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ var fs = require('fs');
module.exports = plugin;

/**
* Metalsmith plugin to run wordpress-esque shortcodes through any jade
* template in a template `directory`. The template file basename should be
* Metalsmith plugin to run wordpress-esque shortcodes through any jade
* template in a template `directory`. The template file basename should be
* the same as the shortcode.
*
* Note this plugin ignores any shortcodes that don't have a corresponding
Expand Down Expand Up @@ -71,12 +71,12 @@ function plugin(opts){
var codes = [], c
while (c = SHORTCODE_RE.exec(str)) codes.push(c[1]);
codes.forEach( function(code){
var tmpl = metalsmith.join(dir, code + ".jade")
// if (shortcodes._shortcodes[code]) return; // need shortcodes.has()
var tmpl = join(dir, code + ".jade")
// if (shortcodes._shortcodes[code]) return; // need shortcodes.has()
debug('found shortcode: %s', code);
try {
fs.readFileSync(tmpl)
} catch(e) {
} catch(e) {
debug('no template found for %s, ignoring', code);
return;
}
Expand All @@ -91,5 +91,3 @@ function plugin(opts){
};

}