From 7215afa21c91c33c924a5aba7f3a704983642897 Mon Sep 17 00:00:00 2001
From: Igor Minar
Date: Tue, 13 Aug 2013 16:57:52 -0700
Subject: chore(ngdocs): fixup the docs version switcher
---
docs/src/ngdoc.js | 10 +++++-----
docs/src/templates/js/docs.js | 4 ++--
lib/grunt/utils.js | 2 --
3 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/docs/src/ngdoc.js b/docs/src/ngdoc.js
index a53fbd80..88d595af 100644
--- a/docs/src/ngdoc.js
+++ b/docs/src/ngdoc.js
@@ -39,7 +39,7 @@ exports.merge = merge;
exports.Doc = Doc;
exports.ngVersions = function() {
- var line, versions = [], regex = /^v([1-9]\d*(?:\.\d+)+)$/; //only fetch >= 1.0.0 versions
+ var versions = [], regex = /^v([1-9]\d*(?:\.\d+\S+)+)$/; //only fetch >= 1.0.0 versions
shell.exec('git tag', {silent: true}).output.split(/\s*\n\s*/)
.forEach(function(line) {
var matches = regex.exec(line);
@@ -47,7 +47,7 @@ exports.ngVersions = function() {
versions.push(matches[1]);
}
});
- versions.push(exports.ngCurrentVersion().number);
+ versions.push(exports.ngCurrentVersion().full);
return versions;
};
@@ -295,7 +295,7 @@ Doc.prototype = {
}
pageClassName = pageClassName || prepareClassName(this.name || 'docs') + suffix;
- text = '
' +
+ text = '
' +
marked(text) +
'
';
text = text.replace(/(?:
)?(REPLACEME\d+)(?:<\/p>)?/g, function(_, id) {
@@ -318,8 +318,8 @@ Doc.prototype = {
text = content;
}
return "\n" + line.replace(pattern, function(match) {
- return '
' +
match +
'
';
diff --git a/docs/src/templates/js/docs.js b/docs/src/templates/js/docs.js
index 54d9a571..16042b3a 100644
--- a/docs/src/templates/js/docs.js
+++ b/docs/src/templates/js/docs.js
@@ -4,9 +4,9 @@ var docsApp = {
serviceFactory: {}
};
-docsApp.controller.DocsVersionsCtrl = ['$scope', '$window', 'NG_VERSIONS', function($scope, $window, NG_VERSIONS) {
+docsApp.controller.DocsVersionsCtrl = ['$scope', '$window', 'NG_VERSIONS', 'NG_VERSION', function($scope, $window, NG_VERSIONS, NG_VERSION) {
$scope.versions = expandVersions(NG_VERSIONS);
- $scope.version = ($scope.version || angular.version.full).match(/^([\d\.]+\d+)/)[1]; //match only the number
+ $scope.version = ($scope.version || NG_VERSION).match(/^([\d\.]+\d+\S+)/)[1]; //match only the number
$scope.jumpToDocsVersion = function(value) {
var isLastStable,
diff --git a/lib/grunt/utils.js b/lib/grunt/utils.js
index 13150e29..ff2c6e1d 100644
--- a/lib/grunt/utils.js
+++ b/lib/grunt/utils.js
@@ -22,9 +22,7 @@ module.exports = {
var hash = shell.exec('git rev-parse --short HEAD', {silent: true}).output.replace('\n', '');
var fullVersion = (match[1] + (match[2] ? '-' + hash : ''));
- var numVersion = semver[0] + '.' + semver[1] + '.' + semver[2];
version = {
- number: numVersion,
full: fullVersion,
major: semver[0],
minor: semver[1],
--
cgit v1.2.3