Fix conrefs loader with filename starting with /

This commit is contained in:
Samy Pessé
2016-02-24 14:20:53 +01:00
parent 255a78a534
commit daa80dc949
+3 -4
View File
@@ -5,6 +5,7 @@ var folderOutput = require('./folder');
var Git = require('../utils/git');
var fs = require('../utils/fs');
var pathUtil = require('../utils/path');
var location = require('../utils/location');
/*
Mixin for output to resolve git conrefs
@@ -48,10 +49,8 @@ module.exports = function conrefsLoader(Base) {
ConrefsLoader.prototype.onResolveTemplate = function(from, to) {
// If origin is in the book, we enforce result file to be in the book
if (this.book.isInBook(from)) {
return this.book.resolve(
this.book.relative(path.dirname(from)),
to
);
var href = location.toAbsolute(to, path.dirname(from), '');
return this.book.resolve(href);
}
// If origin is in a git repository, we resolve file in the git repository