Create source code links during apidoc creation
This commit is contained in:
@@ -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>';
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
<?js
|
||||
var data = obj;
|
||||
var self = this;
|
||||
var version = self.find({kind: 'package' })[0].version;
|
||||
if (/-dev$/.test(version)) {
|
||||
version = 'main';
|
||||
} else {
|
||||
version = 'v' + version;
|
||||
}
|
||||
?>
|
||||
<dt class="<?js= (data.stability && data.stability !== 'stable') ? 'unstable' : '' ?>">
|
||||
<div class="nameContainer<?js if (data.inherited) { ?> inherited<?js } ?>">
|
||||
@@ -16,7 +22,8 @@ var self = this;
|
||||
</h4>
|
||||
<?js if (data.meta) {?>
|
||||
<div class="tag-source">
|
||||
<?js= self.linkto(meta.filename) ?>, <?js= self.linkto(meta.filename, 'line ' + meta.lineno, null, 'line' + meta.lineno) ?>
|
||||
<a href="https://github.com/openlayers/openlayers/blob/<?js= version ?>/src/ol/<?js= meta.filename ?>"><?js= meta.filename ?></a>,
|
||||
<a href="https://github.com/openlayers/openlayers/blob/<?js= version ?>/src/ol/<?js= meta.filename ?>#L<?js= meta.lineno ?>">line <?js= meta.lineno ?></a>
|
||||
</div>
|
||||
<?js } ?>
|
||||
<?js } ?>
|
||||
|
||||
Reference in New Issue
Block a user