You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ra...@apache.org on 2023/02/14 13:26:00 UTC
[arrow] branch master updated: GH-34023: [Docs] Version warning about viewing old docs doesn't work for versions >= 10 (#34178)
This is an automated email from the ASF dual-hosted git repository.
raulcd pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/master by this push:
new fcb13962b3 GH-34023: [Docs] Version warning about viewing old docs doesn't work for versions >= 10 (#34178)
fcb13962b3 is described below
commit fcb13962b3e73e259567a9f0199dbe4ceaea69a5
Author: Alenka Frim <Al...@users.noreply.github.com>
AuthorDate: Tue Feb 14 14:25:52 2023 +0100
GH-34023: [Docs] Version warning about viewing old docs doesn't work for versions >= 10 (#34178)
### Rationale for this change
Due to a bump in number of characters in the major version number (7, 8, 9 etc -> 10) the check for versions in `versionwarning.js` no longer works as expected.
### What changes are included in this PR?
Update of the checks in `versionwarning.js` file.
### Are these changes tested?
Yes, on the apache/arrow-site PR:
- https://github.com/apache/arrow-site/pull/312
- https://arrow.apache.org/docs/10.0/index.html
### Are there any user-facing changes?
No.
* Closes: #34023
Authored-by: Alenka Frim <fr...@gmail.com>
Signed-off-by: Raúl Cumplido <ra...@gmail.com>
---
docs/source/_static/versionwarning.js | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/docs/source/_static/versionwarning.js b/docs/source/_static/versionwarning.js
index a9bea99aff..601b93b75d 100644
--- a/docs/source/_static/versionwarning.js
+++ b/docs/source/_static/versionwarning.js
@@ -30,6 +30,7 @@
// Path of the page
var location_array = location.pathname.split('/');
var versionPath = location_array[2];
+ var majorVersionNumber = Number(versionPath.match(/^\d+/))
var subPath = location_array[3];
var filePath = location_array.slice(3).join('/');
// Links to stable or dev versions
@@ -54,8 +55,8 @@
$('.container-fluid').prepend(`${showWarning}`)
}
});
- } else if (versionPath.match(/^\d/) < "4") {
- // old versions 1.0,. 2.0 or 3.0
+ } else if (majorVersionNumber < 4) {
+ // old versions 1.0, 2.0 or 3.0
$.ajax({
type: 'HEAD',
url: `${uri_stable}`,
@@ -85,7 +86,7 @@
});
}
});
- } else if (versionPath.match(/^\d/) && subPath == 'developers') {
+ } else if (majorVersionNumber && subPath == 'developers') {
// older versions of developers section (with numbered version in the URL)
$.ajax({
type: 'HEAD',
@@ -101,7 +102,7 @@
$('.container-fluid').prepend(`${showWarning}`)
}
});
- } else if (versionPath.match(/^\d/)) {
+ } else if (majorVersionNumber) {
// older versions (with numbered version in the URL)
$.ajax({
type: 'HEAD',