diff options
author | James Phillpotts <jphillpotts@scottlogic.co.uk> | 2014-04-10 11:00:52 +0100 |
---|---|---|
committer | James Phillpotts <jphillpotts@scottlogic.co.uk> | 2014-04-10 11:00:52 +0100 |
commit | 8f457a752eef936eba95ce3de7bb8e490b1ba4ea (patch) | |
tree | a78944a4313785bd373b9f54f46afcfe392f1345 /lib/parse/renderer.js | |
parent | 435a4b8c99ae739316af1bf5db9fcc8b0cd104ef (diff) | |
download | gitbook-8f457a752eef936eba95ce3de7bb8e490b1ba4ea.zip gitbook-8f457a752eef936eba95ce3de7bb8e490b1ba4ea.tar.gz gitbook-8f457a752eef936eba95ce3de7bb8e490b1ba4ea.tar.bz2 |
Use OS-agnostic path generation for images too
Diffstat (limited to 'lib/parse/renderer.js')
-rw-r--r-- | lib/parse/renderer.js | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/parse/renderer.js b/lib/parse/renderer.js index d0ca597..6b45a22 100644 --- a/lib/parse/renderer.js +++ b/lib/parse/renderer.js @@ -76,10 +76,8 @@ GitBookRenderer.prototype.image = function(href, title, text) { // Relative image, rewrite it depending output if(!parsed.protocol && parsed.path && parsed.path[0] != '/' && o && o.dir && o.outdir) { - _href = path.relative(o.outdir, path.normalize(path.join( - o.dir, - href - ))); + var outdir = o.outdir.charAt(o.outdir.length - 1) === '/' ? o.outdir : o.outdir + '/'; + _href = url.resolve(outdir, [o.dir, href].join('/')); } return GitBookRenderer.super_.prototype.image.call(this, _href, title, text); |