diff options
author | James Phillpotts <jphillpotts@scottlogic.co.uk> | 2014-04-10 10:31:32 +0100 |
---|---|---|
committer | James Phillpotts <jphillpotts@scottlogic.co.uk> | 2014-04-10 10:31:32 +0100 |
commit | fb7653bd14c9fa08ad7cc5db1f5acfddd7d37d0b (patch) | |
tree | d928cfbd2501e04c568f239b6d3567c08fe61570 /lib | |
parent | 2e85380cd822e05072b00d5f2493c263ac194395 (diff) | |
download | gitbook-fb7653bd14c9fa08ad7cc5db1f5acfddd7d37d0b.zip gitbook-fb7653bd14c9fa08ad7cc5db1f5acfddd7d37d0b.tar.gz gitbook-fb7653bd14c9fa08ad7cc5db1f5acfddd7d37d0b.tar.bz2 |
Fix URL creation on windows
Diffstat (limited to 'lib')
-rw-r--r-- | lib/parse/renderer.js | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/lib/parse/renderer.js b/lib/parse/renderer.js index 86576f0..534a859 100644 --- a/lib/parse/renderer.js +++ b/lib/parse/renderer.js @@ -46,16 +46,11 @@ GitBookRenderer.prototype.link = function(href, title, text) { var o = this._extra_options; // Relative link, rewrite it to point to github repo if(!parsed.protocol && parsed.path && parsed.path[0] != '/' && o && o.repo && o.dir) { - href = 'https://github.com/' + o.repo + '/blob' + path.normalize(path.join( - '/', - o.dir, - href - )); - parsed = url.parse(href); + parsed = url.parse('https://github.com/' + o.repo + '/blob/').resolveObject([o.dir, href].join("/")); } // Generate HTML for link - var out = '<a href="' + href + '"'; + var out = '<a href="' + parsed.href + '"'; // Title if no null if (title) { out += ' title="' + title + '"'; |