diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-04-11 09:56:13 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-04-11 09:56:13 +0200 |
commit | dabdeb8a807ec9c20d05246e1c1704f9762edae1 (patch) | |
tree | 4524febd5c91dc8fe834b084e8c20dbaa5244588 | |
parent | ecd56315e60e4b90ac69fea97ad1f896ddaecf4e (diff) | |
download | gitbook-dabdeb8a807ec9c20d05246e1c1704f9762edae1.zip gitbook-dabdeb8a807ec9c20d05246e1c1704f9762edae1.tar.gz gitbook-dabdeb8a807ec9c20d05246e1c1704f9762edae1.tar.bz2 |
Fix #1195: fix external images and fix test for it
-rw-r--r-- | lib/output/base.js | 4 | ||||
-rw-r--r-- | test/page.js | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/lib/output/base.js b/lib/output/base.js index 903323f..a342c1e 100644 --- a/lib/output/base.js +++ b/lib/output/base.js @@ -207,6 +207,10 @@ Output.prototype.onOutputSVG = function(page, svg) { // Output an image as a file // Normalize the relative link Output.prototype.onOutputImage = function(page, imgFile) { + if (location.isExternal(imgFile)) { + return imgFile; + } + imgFile = page.resolveLocal(imgFile); return page.relative(imgFile); }; diff --git a/test/page.js b/test/page.js index f961653..0fc59e7 100644 --- a/test/page.js +++ b/test/page.js @@ -289,7 +289,7 @@ describe('Page', function() { it('should keep external images path', function() { page.content.should.be.html({ - 'img[src="https:/upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png"]': { + 'img[src="https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png"]': { count: 1 } }); |