Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit f4fcaa8

Browse files
committed
docs: fix the "show source" button
Closes #4904
1 parent 40e34a9 commit f4fcaa8

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

docs/src/ngdoc.js

+14-2
Original file line numberDiff line numberDiff line change
@@ -547,10 +547,22 @@ Doc.prototype = {
547547
self = this,
548548
minerrMsg;
549549

550+
var gitTagFromFullVersion = function(version) {
551+
var match = version.match(/-(\w{7})/);
552+
553+
if (match) {
554+
// git sha
555+
return match[1];
556+
}
557+
558+
// git tag
559+
return 'v' + version;
560+
};
561+
550562
if (this.section === 'api') {
551563
dom.tag('a', {
552-
href: 'http://github.com/angular/angular.js/tree/v' +
553-
gruntUtil.getVersion().cdn + '/' + self.file + '#L' + self.line,
564+
href: 'http://github.com/angular/angular.js/tree/' +
565+
gitTagFromFullVersion(gruntUtil.getVersion().full) + '/' + self.file + '#L' + self.line,
554566
class: 'view-source btn btn-action' }, function(dom) {
555567
dom.tag('i', {class:'icon-zoom-in'}, ' ');
556568
dom.text(' View source');

0 commit comments

Comments
 (0)