diff options
author | Samy Pessé <samypesse@gmail.com> | 2015-09-15 11:09:08 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2015-09-15 11:09:08 +0200 |
commit | baf10e9b159b64c30ce650c83eb437675434e3e2 (patch) | |
tree | 583fc00922e6ca52fea87947af0b4d5703aabf7d /lib/utils/navigation.js | |
parent | 463a947df1e5c8c862c555a5b0ae675e356a0d5c (diff) | |
download | gitbook-baf10e9b159b64c30ce650c83eb437675434e3e2.zip gitbook-baf10e9b159b64c30ce650c83eb437675434e3e2.tar.gz gitbook-baf10e9b159b64c30ce650c83eb437675434e3e2.tar.bz2 |
Improve book.resolve to ensure file is in the book
Adapt tests to plugin-highlight
Diffstat (limited to 'lib/utils/navigation.js')
-rw-r--r-- | lib/utils/navigation.js | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/utils/navigation.js b/lib/utils/navigation.js index af9330d..d825c2c 100644 --- a/lib/utils/navigation.js +++ b/lib/utils/navigation.js @@ -27,7 +27,7 @@ function navigation(summary, files) { files = _.isArray(files) ? files : (_.isString(files) ? [files] : null); // List of all navNodes - // Flatten chapters, then add in default README node if needed etc ... + // Flatten chapters var navNodes = flattenChapters(summary.chapters); // Mapping of prev/next for a give path @@ -39,8 +39,7 @@ function navigation(summary, files) { if(!current.exists) return null; // Find prev - prev = _.chain(navNodes) - .slice(0, i) + prev = _.chain(navNodes.slice(0, i)) .reverse() .find(function(node) { return node.exists && !node.external; @@ -48,14 +47,12 @@ function navigation(summary, files) { .value(); // Find next - next = _.chain(navNodes) - .slice(i+1) + next = _.chain(navNodes.slice(i+1)) .find(function(node) { return node.exists && !node.external; }) .value(); - return [current.path, { index: i, title: current.title, |