diff options
author | Aaron O'Mullan <aaron.omullan@gmail.com> | 2014-04-18 10:17:20 -0700 |
---|---|---|
committer | Aaron O'Mullan <aaron.omullan@gmail.com> | 2014-04-18 10:17:20 -0700 |
commit | 0d9d62f1a9987d32299eb8e5a65d5de2cf7b0758 (patch) | |
tree | 27534a3644a28f1a535ad5ecbd05f1f5e2e351e5 /lib/parse/renderer.js | |
parent | f7e9abf984f7cf5e062ec4ce929bd77d3b2528e3 (diff) | |
parent | dd0579b60d29da744ef49aae26423b91529ac8cd (diff) | |
download | gitbook-0d9d62f1a9987d32299eb8e5a65d5de2cf7b0758.zip gitbook-0d9d62f1a9987d32299eb8e5a65d5de2cf7b0758.tar.gz gitbook-0d9d62f1a9987d32299eb8e5a65d5de2cf7b0758.tar.bz2 |
Merge pull request #117 from GitbookIO/fix/99
Fix #99
Diffstat (limited to 'lib/parse/renderer.js')
-rw-r--r-- | lib/parse/renderer.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/parse/renderer.js b/lib/parse/renderer.js index 2a72d48..949a9ee 100644 --- a/lib/parse/renderer.js +++ b/lib/parse/renderer.js @@ -79,8 +79,14 @@ 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) { - var outdir = o.outdir.charAt(o.outdir.length - 1) === '/' ? o.outdir : o.outdir + '/'; - _href = url.resolve(outdir, [o.dir, href].join('/')); + // o.dir: directory parent of the file currently in rendering process + // o.outdir: directory parent from the html output + + // Absolute file in source + _href = path.join(o.dir, _href); + + // make it relative to output + _href = path.relative(o.outdir, _href); } return GitBookRenderer.super_.prototype.image.call(this, _href, title, text); |