summaryrefslogtreecommitdiffstats
path: root/lib/parse/renderer.js
diff options
context:
space:
mode:
authorAaron O'Mullan <aaron.omullan@friendco.de>2014-04-08 14:47:36 -0700
committerAaron O'Mullan <aaron.omullan@friendco.de>2014-04-08 14:47:36 -0700
commit554d6a6170d448d3c4cd635528d4f94e928472f2 (patch)
treee4f4ec806a198995d78cd2711b07c4acc594e32d /lib/parse/renderer.js
parent2182baa2e9bf520943871c52340066cfdd28ba0b (diff)
downloadgitbook-554d6a6170d448d3c4cd635528d4f94e928472f2.zip
gitbook-554d6a6170d448d3c4cd635528d4f94e928472f2.tar.gz
gitbook-554d6a6170d448d3c4cd635528d4f94e928472f2.tar.bz2
Fix URL rewriting error on empty URLs
Fixes #54, fixes #59
Diffstat (limited to 'lib/parse/renderer.js')
-rw-r--r--lib/parse/renderer.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/parse/renderer.js b/lib/parse/renderer.js
index 848f6e3..86576f0 100644
--- a/lib/parse/renderer.js
+++ b/lib/parse/renderer.js
@@ -45,7 +45,7 @@ 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[0] != '/' && o && o.repo && o.dir) {
+ 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,
@@ -79,7 +79,7 @@ GitBookRenderer.prototype.image = function(href, title, text) {
var o = this._extra_options;
// Relative image, rewrite it depending output
- if(!parsed.protocol && parsed.path[0] != '/' && o && o.dir && o.outdir) {
+ 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