summaryrefslogtreecommitdiffstats
path: root/lib/parse/parseSummary.js
diff options
context:
space:
mode:
authorJohan Preynat <johan.preynat@gmail.com>2016-04-29 14:35:56 +0200
committerJohan Preynat <johan.preynat@gmail.com>2016-04-29 14:38:12 +0200
commit94199af7b293b9c6f82a2e1c341587adee5b0792 (patch)
tree44de86b051017c509c35320e127fd95e99ceefef /lib/parse/parseSummary.js
parentb8d7a00f58401d827ef06b76f4a9f189b89c7606 (diff)
downloadgitbook-94199af7b293b9c6f82a2e1c341587adee5b0792.zip
gitbook-94199af7b293b9c6f82a2e1c341587adee5b0792.tar.gz
gitbook-94199af7b293b9c6f82a2e1c341587adee5b0792.tar.bz2
Add location.areIdenticalPaths(p1,p2) to effectively compare two paths
Diffstat (limited to 'lib/parse/parseSummary.js')
-rw-r--r--lib/parse/parseSummary.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/parse/parseSummary.js b/lib/parse/parseSummary.js
index 2c6186f..72bf224 100644
--- a/lib/parse/parseSummary.js
+++ b/lib/parse/parseSummary.js
@@ -1,6 +1,7 @@
var parseStructureFile = require('./parseStructureFile');
var Summary = require('../models/summary');
var SummaryModifier = require('../modifiers').Summary;
+var location = require('../utils/location');
/**
Parse summary in a book, the summary can only be parsed
@@ -28,8 +29,9 @@ function parseSummary(book) {
// Insert readme as first entry
var firstArticle = summary.getFirstArticle();
+
if (readmeFile.exists() &&
- (!firstArticle || firstArticle.getRef() !== readmeFile.getPath())) {
+ (!firstArticle || !location.areIdenticalPaths(firstArticle.getRef(), readmeFile.getPath()))) {
summary = SummaryModifier.unshiftArticle(summary, {
title: 'Introduction',
ref: readmeFile.getPath()