Skip to content

Commit

Permalink
Merge pull request #42 from bem-site/correct-relative-docs
Browse files Browse the repository at this point in the history
Correct build link on relative github docs
  • Loading branch information
Gela committed Aug 5, 2015
2 parents e2e3bbb + 5910326 commit b5f1648
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/tasks/override-links.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var util = require('util'),
path = require('path'),
url = require('url'),

_ = require('lodash'),
vow = require('vow'),
Expand Down Expand Up @@ -99,10 +100,8 @@ function fixGithubLinks(str) {
function buildFullGithubLinkForDocs(str, doc, treeOrBlob, node) {
var jsonMatch = str.match(REGEXP.RELATIVE.JSON);

if (doc && doc.repo) {
var repo = doc.repo;
return 'https://' + path.join(repo.host, repo.user, repo.repo, treeOrBlob, repo.ref,
str.indexOf('.') === 0 ? path.dirname(repo.path) : '', str.replace(/^\//, ''));
if (doc && doc.url) {
return url.resolve(doc.url, str);
} else if (jsonMatch) {
var ghLibVersionUrl = node.ghLibVersionUrl,
version = node.route.conditions.version;
Expand Down

0 comments on commit b5f1648

Please sign in to comment.