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

Commit 7215afa

Browse files
committed
chore(ngdocs): fixup the docs version switcher
1 parent 9097906 commit 7215afa

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

docs/src/ngdoc.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ exports.merge = merge;
3939
exports.Doc = Doc;
4040

4141
exports.ngVersions = function() {
42-
var line, versions = [], regex = /^v([1-9]\d*(?:\.\d+)+)$/; //only fetch >= 1.0.0 versions
42+
var versions = [], regex = /^v([1-9]\d*(?:\.\d+\S+)+)$/; //only fetch >= 1.0.0 versions
4343
shell.exec('git tag', {silent: true}).output.split(/\s*\n\s*/)
4444
.forEach(function(line) {
4545
var matches = regex.exec(line);
4646
if(matches && matches.length > 0) {
4747
versions.push(matches[1]);
4848
}
4949
});
50-
versions.push(exports.ngCurrentVersion().number);
50+
versions.push(exports.ngCurrentVersion().full);
5151
return versions;
5252
};
5353

@@ -295,7 +295,7 @@ Doc.prototype = {
295295
}
296296
pageClassName = pageClassName || prepareClassName(this.name || 'docs') + suffix;
297297

298-
text = '<div class="' + pageClassName + '">' +
298+
text = '<div class="' + pageClassName + '">' +
299299
marked(text) +
300300
'</div>';
301301
text = text.replace(/(?:<p>)?(REPLACEME\d+)(?:<\/p>)?/g, function(_, id) {
@@ -318,8 +318,8 @@ Doc.prototype = {
318318
text = content;
319319
}
320320
return "\n" + line.replace(pattern, function(match) {
321-
return '<div class="nocode nocode-content" data-popover ' +
322-
'data-content="' + text + '" ' +
321+
return '<div class="nocode nocode-content" data-popover ' +
322+
'data-content="' + text + '" ' +
323323
'data-title="' + title + '">' +
324324
match +
325325
'</div>';

docs/src/templates/js/docs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ var docsApp = {
44
serviceFactory: {}
55
};
66

7-
docsApp.controller.DocsVersionsCtrl = ['$scope', '$window', 'NG_VERSIONS', function($scope, $window, NG_VERSIONS) {
7+
docsApp.controller.DocsVersionsCtrl = ['$scope', '$window', 'NG_VERSIONS', 'NG_VERSION', function($scope, $window, NG_VERSIONS, NG_VERSION) {
88
$scope.versions = expandVersions(NG_VERSIONS);
9-
$scope.version = ($scope.version || angular.version.full).match(/^([\d\.]+\d+)/)[1]; //match only the number
9+
$scope.version = ($scope.version || NG_VERSION).match(/^([\d\.]+\d+\S+)/)[1]; //match only the number
1010

1111
$scope.jumpToDocsVersion = function(value) {
1212
var isLastStable,

lib/grunt/utils.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ module.exports = {
2222
var hash = shell.exec('git rev-parse --short HEAD', {silent: true}).output.replace('\n', '');
2323

2424
var fullVersion = (match[1] + (match[2] ? '-' + hash : ''));
25-
var numVersion = semver[0] + '.' + semver[1] + '.' + semver[2];
2625
version = {
27-
number: numVersion,
2826
full: fullVersion,
2927
major: semver[0],
3028
minor: semver[1],

0 commit comments

Comments
 (0)