diff options
author | Aaron O'Mullan <aaron.omullan@friendco.de> | 2014-07-29 20:49:11 -0700 |
---|---|---|
committer | Aaron O'Mullan <aaron.omullan@friendco.de> | 2014-07-29 20:49:11 -0700 |
commit | 0134677e0e1bd6a1de68a011c96d2960fea15a61 (patch) | |
tree | 7509ac4400ec19deaabf3b956aaa1a64439c2853 /lib/parse | |
parent | 39ef4fa199acb491e72860042b43affacdf79249 (diff) | |
download | gitbook-0134677e0e1bd6a1de68a011c96d2960fea15a61.zip gitbook-0134677e0e1bd6a1de68a011c96d2960fea15a61.tar.gz gitbook-0134677e0e1bd6a1de68a011c96d2960fea15a61.tar.bz2 |
Improve path normalization when parsing SUMMARY.md
Diffstat (limited to 'lib/parse')
-rw-r--r-- | lib/parse/summary.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/parse/summary.js b/lib/parse/summary.js index fd300bc..c73a072 100644 --- a/lib/parse/summary.js +++ b/lib/parse/summary.js @@ -81,8 +81,10 @@ function parseTitle(src, nums) { title: matches[1], level: level, - // Replace .md references with .html - path: matches[2].replace(/\\/g, '/'), + // Normalize path + // 1. Convert Window's "\" to "/" + // 2. Remove leading "/" if exists + path: matches[2].replace(/\\/g, '/').replace(/^\/+/, ''), }; } |