Skip to content

Commit

Permalink
jslint
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Chu committed Jan 18, 2010
1 parent 7e4183f commit da5cf3e
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions lib/recipe/doc.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ var IndexBuilder = exports.IndexBuilder = function(
// Returns the top of the stack
var destDir = function() {
return dirStack[dirStack.length-1];
}
};

that.empty = function() {
return indexStack.length === 0;
}
};

// Call this when receiving a regular doc to be indexed
that.onDoc = function(items) {
Expand All @@ -37,12 +37,12 @@ var IndexBuilder = exports.IndexBuilder = function(
for (var i = 0; i < len; i++) {
indexStack[i]['all-docs'].push(perDocData);
}
}
};

// Call this when discovering a doc with the .index attribute
that.onIndexDoc = function(relativePath) {
indexStack[indexStack.length-1]['index-docs'].push(relativePath);
}
};

that.enterDir = function (destDir) {
// Record that this dir is a child of its parent dir
Expand All @@ -55,9 +55,9 @@ var IndexBuilder = exports.IndexBuilder = function(
'docs': [], // just the docs in this directory
'dirs': [], // just the dirs in this directory
'all-docs': [], // recursive listing of all docs in the subtree
'index-docs': [], // .index docs in this directory
'index-docs': [] // .index docs in this directory
});
}
};

that.exitDir = function () {
dirStack.pop();
Expand Down Expand Up @@ -99,7 +99,7 @@ var IndexBuilder = exports.IndexBuilder = function(
log.error('Error converting %s: %s', filename, error);
if (!options.get('keep-going')) {
throw error;
};
}
}

docStack.pop(); // body
Expand All @@ -108,10 +108,10 @@ var IndexBuilder = exports.IndexBuilder = function(
docStack.pop(); // index doc
}
}
}
};

return that;
}
};

// Extracts metadata from a filename.
// TODO: possibly get categories/tags from the directory tree?
Expand Down Expand Up @@ -145,7 +145,7 @@ var extractMetadata = exports.extractMetadata = function(relPath) {
meta['title'] = title.replace(/-/g, ' ');

return meta;
}
};

var META_RE = /^\s*(\S+):\s*(.*)/;

Expand All @@ -155,7 +155,7 @@ var META_RE = /^\s*(\S+):\s*(.*)/;
// JSON. This may be useful if the keys contain unusual characters (like
// spaces, although that is frowned upon)
var parseFrontMatter = exports.parseFrontMatter = function(lines) {
if (lines[0] && lines[0].match(/\s*{/)) {
if (lines[0] && lines[0].match(/\s*\{/)) {
return util.parseJsonConfig(lines.join(''));
}
var metadata = {};
Expand Down Expand Up @@ -184,7 +184,7 @@ var parseFrontMatter = exports.parseFrontMatter = function(lines) {
}
}
return metadata;
}
};

// Get metadata and content from a source document
// Returns:
Expand Down Expand Up @@ -225,7 +225,7 @@ var readSource = exports.readSource = function(sourceTree, sourceFile) {
// TODO: rewind() doesn't exist?
//f.rewind();
f.close();
f = sourceTree.open(sourceFile),
f = sourceTree.open(sourceFile);
body = f.read(); // the rest is content
}
var parsed = parseFrontMatter(metadataLines);
Expand Down

0 comments on commit da5cf3e

Please sign in to comment.