fixed issue with new lines for new versions (#58)
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 @@
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 branch=master
export action=build
+export versions_filename="../docs/available-versions.txt"
+
while [ "$#" -gt 0 ]; do
case "$1" in
--version=*)
@@ -59,19 +61,23 @@
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