Better version ordering of documentation

This commit is contained in:
flip1995 2020-02-13 17:32:29 +01:00
parent 5e03d5bb06
commit 2044931cbe
No known key found for this signature in database
GPG key ID: 693086869D506637

View file

@ -36,7 +36,7 @@
<ul class="list-group">
<a class="list-group-item" ng-repeat="version in data | orderBy:versionOrder:true"
href="./{{version}}/index.html">
{{normalizeVersion(version)}}
{{normalizeVersionDisplay(version)}}
</a>
</ul>
</article>
@ -54,10 +54,14 @@
.controller('docVersions', function ($scope, $http) {
$scope.loading = true;
$scope.normalizeVersion = function(v) {
$scope.normalizeVersionDisplay = function(v) {
return v.replace(/^v/, '');
};
$scope.normalizeVersion = function(v) {
return v.replace(/^v/, '').replace(/^rust-/, '');
};
$scope.versionOrder = function(v) {
if (v === 'master') { return Infinity; }
if (v === 'current') { return Number.MAX_VALUE; }