Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix _id handling

  • Loading branch information...
commit 20dd84a3df338359044c8c7ad2b9f97d0af5f981 1 parent 0a9cef6
Paul Vorbach authored
Showing with 13 additions and 13 deletions.
  1. +13 −13 bake.js
26 bake.js
View
@@ -16,7 +16,7 @@ var bake = function(conf, hooks, cb) {
if (typeof conf != 'object')
return cb(new Error('parameter conf must be a valid configuration object'));
- // Set values for `inputDir`, `outputDir` and `tplDir`
+ // Set values for inputDir, outputDir and tplDir
var root = conf.root || process.cwd();
var inputDir = conf.directories.input || 'pub';
var outputDir = conf.directories.output || 'pub';
@@ -26,10 +26,10 @@ var bake = function(conf, hooks, cb) {
outputDir = path.resolve(root, outputDir);
tplDir = path.resolve(root, tplDir);
- // Set values for `fileExt`
+ // Set values for fileExt
var fileExt = conf.fileExtensions || { txt: 'html' };
var fileExtPattern
- = new RegExp('\.(' + Object.keys(fileExt).join('|') + ')$', 'i');
+ = new RegExp('\\.(' + Object.keys(fileExt).join('|') + ')$', 'i');
// Status log
console.log('Beginning to bake ' + inputDir + '.');
@@ -59,18 +59,18 @@ var bake = function(conf, hooks, cb) {
return cb(err);
// Get the properties
- // `prop` is the file specific property object
+ // prop is the file specific property object
var prop = props(data);
- // Amend `prop` by properties in `conf.properties` if defined
+ // Amend prop by properties in conf.properties if defined
if (conf.properties)
prop = append(clone(conf.properties), prop);
- // Assert that `prop.template` is set
+ // Assert that prop.template is set
if (typeof prop.template == 'undefined')
prop.template = 'default.tpl';
- // `__propBefore` hook
+ // __propBefore hook
if (hooks.__propBefore)
hooks.__propBefore(master, prop, propBeforeCB);
else
@@ -100,7 +100,7 @@ var bake = function(conf, hooks, cb) {
if (err)
return cb(err);
- // `__propAfter` hook
+ // __propAfter hook
if (hooks.__propAfter)
hooks.__propAfter(master, prop, propAfterCB);
else
@@ -118,7 +118,7 @@ var bake = function(conf, hooks, cb) {
return cb(err);
// (Pre-)Insert the content (so ejs-tags in
- // `prop.__content` are parsed, too.
+ // prop.__content are parsed, too.
result = result.replace(/<%=\s+__content\s+%>/g,
prop.__content);
@@ -129,7 +129,7 @@ var bake = function(conf, hooks, cb) {
// New file's path
if (typeof prop._id == 'undefined') {
prop._id = resName.replace(inputDir, '');
- prop._id = prop._id.replace(/\\/, '/');
+ prop._id = prop._id.replace('\\', '/');
}
// Render ejs-template
@@ -137,7 +137,7 @@ var bake = function(conf, hooks, cb) {
// Remove first slash
if (/^\//.test(prop._id))
- prop._id = prop._id.substring(1)
+ prop._id = prop._id.substring(1);
// absolute path
resName = path.resolve(outputDir, prop._id);
@@ -148,7 +148,7 @@ var bake = function(conf, hooks, cb) {
if (err)
return cb(err);
- // `__written` hook
+ // __writeAfter hook
if (hooks.__writeAfter)
hooks.__writeAfter(master, prop, writeAfterCB);
else
@@ -163,7 +163,7 @@ var bake = function(conf, hooks, cb) {
// When file counter is zero
if (!--todo) {
- // `__complete` hook
+ // __complete hook
if (hooks.__complete)
hooks.__complete(master, prop, cb);
else
Please sign in to comment.
Something went wrong with that request. Please try again.