Fix URL creation on windows

This commit is contained in:
James Phillpotts
2014-04-10 10:31:32 +01:00
parent 2e85380cd8
commit fb7653bd14
+2 -7
View File
@@ -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 + '"';