You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by dm...@apache.org on 2020/12/28 16:45:27 UTC

[ignite-website] branch master updated: fixed issue with new lines for new versions (#58)

This is an automated email from the ASF dual-hosted git repository.

dmagda pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite-website.git


The following commit(s) were added to refs/heads/master by this push:
     new 030ba54  fixed issue with new lines for new versions (#58)
030ba54 is described below

commit 030ba54f971671933c6948cbdf35c8a362aa3fde
Author: Mauricio Stekl <ma...@stekl.org>
AuthorDate: Mon Dec 28 13:45:17 2020 -0300

    fixed issue with new lines for new versions (#58)
---
 _docs/assets/js/versioning.js | 17 ++++++++++-------
 _docs/build.sh                | 22 ++++++++++++++--------
 2 files changed, 24 insertions(+), 15 deletions(-)

diff --git a/_docs/assets/js/versioning.js b/_docs/assets/js/versioning.js
index 6ce044d..2386f5b 100644
--- a/_docs/assets/js/versioning.js
+++ b/_docs/assets/js/versioning.js
@@ -25,13 +25,16 @@ function initVersioning()
                     dropdown.length = 0;
 
                     for(let i = 0; i < lines.length; i++){
-                        new_option = document.createElement('option');
-                        new_option.text = lines[i];
-                        let r = isLatest?"latest":currentDocVersion;
-                        new_option.value = currentPath.replace(r, lines[i]);
-                        dropdown.add(new_option);
-                        if(lines[i] == currentDocVersion) 
-                            dropdown.selectedIndex = i;
+                        if(String(lines[i]).trim().length > 0){
+                            new_option = document.createElement('option');
+                            new_option.text = lines[i];
+                            let r = isLatest?"latest":currentDocVersion;
+                            new_option.value = currentPath.replace(r, lines[i]);
+                            dropdown.add(new_option);
+                            if(lines[i] == currentDocVersion) 
+                                dropdown.selectedIndex = i;
+                        }
+                        
                     }
 
                     dropdown.addEventListener('change', function(){
diff --git a/_docs/build.sh b/_docs/build.sh
index a4290f9..efc278c 100755
--- a/_docs/build.sh
+++ b/_docs/build.sh
@@ -4,6 +4,8 @@ export latest=no
 export branch=master
 export action=build
 
+export versions_filename="../docs/available-versions.txt"
+
 while [ "$#" -gt 0 ]; do
   case "$1" in
     --version=*)
@@ -59,19 +61,23 @@ if [ "$action" = "build" ]; then
   cp -R _site/docs/$version ../docs/$version
   cp -R _site/assets ../
 
-  if [ "$latest" = "yes" ]; then
-    rm ../docs/latest
-    ln -s ../docs/$version ../docs/latest
-  fi
+  # if [ "$latest" = "yes" ]; then
+    # rm ../docs/latest
+    # ln -s ../docs/$version ../docs/latest
+  # fi
 
   # add the version number to the .txt file used by the version selector dropdown on the UI
-  if ! grep -Fxq "$version" ../docs/available-versions.txt; then
+  if ! grep -Fxq "$version" "$versions_filename"; then
     # adds the version to the top of the list if 'latest', otherwise to the bottom
     if [ "$latest" = "yes" ]; then
-      cat <(echo "$version") ../docs/available-versions.txt > ../docs/available-versions.new
-      mv ../docs/available-versions.new ../docs/available-versions.txt
+      cat <(echo "$version") "$versions_filename" > ../docs/available-versions.new
+      mv ../docs/available-versions.new "$versions_filename"
     else
-     echo "$version" >> ../docs/available-versions.txt
+      if ! [ -z "$tail -c 1 <"$versions_filename")" ]; then  #just in case the file doesn't end with an EOL already
+        echo "" >> "$versions_filename"
+      fi
+     
+      echo "$version" >> "$versions_filename"
     fi
   fi
 fi