Create source code links during apidoc creation

This commit is contained in:
Maximilian Krög
2020-08-15 22:38:22 +02:00
parent 323fbca2e6
commit 477c331a4c
2 changed files with 9 additions and 15 deletions

View File

@@ -237,10 +237,8 @@ $(function () {
search.manualToggle(clsItem, show);
});
var currentVersion = document.getElementById('package-version').innerHTML;
// warn about outdated version
var currentVersion = document.getElementById('package-version').innerHTML;
var packageUrl = 'https://raw.githubusercontent.com/openlayers/openlayers.github.io/build/package.json';
fetch(packageUrl).then(function(response) {
return response.json();
@@ -265,15 +263,4 @@ $(function () {
}
}
});
// create source code links to github
var srcLinks = $('div.tag-source');
srcLinks.each(function(i, el) {
var textParts = el.innerHTML.trim().split(', ');
var link = 'https://github.com/openlayers/openlayers/blob/v' + currentVersion + '/src/ol/' +
textParts[0];
el.innerHTML = '<a href="' + link + '">' + textParts[0] + '</a>, ' +
'<a href="' + link + textParts[1].replace('line ', '#L') + '">' +
textParts[1] + '</a>';
});
});