Commit b4cc50ab authored by Houtan Bastani's avatar Houtan Bastani

rework download page

parent 07a5f032
......@@ -3,10 +3,10 @@ _site
.jekyll-metadata
# Snapshots
assets/snapshot/*
_includes/snapshot/*
# Releases
assets/release/*
_includes/release/*
# Logo
assets/images/logo/*.aux
......
......@@ -21,30 +21,14 @@
</p>
<p>Executable installer:</p>
<div class="download_table">
{% assign snapshot_files = (site.static_files | where: "snapshot", "windows-exe" | sort: 'modified_time') | reverse %}
{% for snapshot in snapshot_files %}
{% if snapshot.extname == ".exe" %}
<div class="download_row" onclick="document.location = 'https://www.dynare.org/snapshot/windows/{{ snapshot.name }}'" onkeypress="document.location = 'https://www.dynare.org/snapshot/windows/{{ snapshot.name }}'">
<div class="download_cell_left"><i class="fas fa-file-download"></i>&nbsp;{{ snapshot.modified_time | date: "%Y %b %d %R" }}</div>
<div class="download_cell_right"><a href="#">{{ snapshot.name }}</a></div>
</div>
{% endif %}
{% endfor %}
</div>
<div class="download_table">
{% include snapshot/download-snapshot-windows.html %}
</div>
<br />
<p>Zip archive:</p>
<div class="download_table">
{% assign snapshot_files = (site.static_files | where: "snapshot", "windows-zip" | sort: 'modified_time') | reverse %}
{% for snapshot in snapshot_files %}
{% if snapshot.extname == ".zip" %}
<div class="download_row" onclick="document.location = 'https://www.dynare.org/snapshot/windows-zip/{{ snapshot.name }}'" onkeypress="document.location = 'https://www.dynare.org/snapshot-zip/windows/{{ snapshot.name }}'">
<div class="download_cell_left"><i class="fas fa-file-download"></i>&nbsp;{{ snapshot.modified_time | date: "%Y %b %d %R" }}</div>
<div class="download_cell_right"><a href="#">{{ snapshot.name }}</a></div>
</div>
{% endif %}
{% endfor %}
</div>
<div class="download_table">
{% include snapshot/download-snapshot-windows-zip.html %}
</div>
</section>
<section class="dynare_section" id="snapshot_content2">
......@@ -58,15 +42,7 @@
"Open" from the menu that pops up.
</p>
<div class="download_table">
{% assign snapshot_files = (site.static_files | where: "snapshot", "macosx" | sort: 'modified_time') | reverse %}
{% for snapshot in snapshot_files %}
{% if snapshot.extname == ".zip" %}
<div class="download_row" onclick="document.location = 'https://www.dynare.org/snapshot/macosx/{{ snapshot.name }}'" onkeypress="document.location = 'https://www.dynare.org/snapshot/macosx/{{ snapshot.name }}'">
<div class="download_cell_left"><i class="fas fa-file-download"></i>&nbsp;{{ snapshot.modified_time | date: "%Y %b %d %R" }}</div>
<div class="download_cell_right"><a href="#">{{ snapshot.name }}</a></div>
</div>
{% endif %}
{% endfor %}
{% include snapshot/download-snapshot-macosx.html %}
</div>
</section>
......@@ -84,15 +60,7 @@
<section class="dynare_section" id="snapshot_content4">
<p>Source code, not needed by most users.</p>
<div class="download_table">
{% assign snapshot_files = (site.static_files | where: "snapshot", "source" | sort: 'modified_time') | reverse %}
{% for snapshot in snapshot_files %}
{% if snapshot.extname == ".xz" %}
<div class="download_row" onclick="document.location = 'https://www.dynare.org/snapshot/source/{{ snapshot.name }}'" onkeypress="document.location = 'https://www.dynare.org/snapshot/source/{{ snapshot.name }}'">
<div class="download_cell_left"><i class="fas fa-file-download"></i>&nbsp;{{ snapshot.modified_time | date: "%Y %b %d %R" }}</div>
<div class="download_cell_right"><a href="#">{{ snapshot.name }}</a></div>
</div>
{% endif %}
{% endfor %}
{% include snapshot/download-snapshot-source.html %}
</div>
</section>
</div>
......
......@@ -22,19 +22,11 @@
<p>Both an executable installer and a zip archive are available.</p>
<p class="stable">
<i class="fas fa-file-download"></i>
{% assign release = site.static_files | where: "release", "windows-exe" | first %}
{% assign version = release.name | split: '-' %}
{% assign version = version[1] %}
<a href="https://www.dynare.org/release/windows/{{ release.name }}">Dynare {{ version }} ({{ release.extname }})</a>
<a href="https://www.dynare.org/release/windows/{{ release.name }}.sig">[signature]</a>
{% include release/download-release-windows.html %}
</p>
<p class="stable">
<i class="fas fa-file-download"></i>
{% assign release = site.static_files | where: "release", "windows-zip" | first %}
{% assign version = release.name | split: '-' %}
{% assign version = version[1] %}
<a href="https://www.dynare.org/release/windows-zip/{{ release.name }}">Dynare {{ version }} ({{ release.extname }})</a>
<a href="https://www.dynare.org/release/windows-zip/{{ release.name }}.sig">[signature]</a>
{% include release/download-release-windows-zip.html %}
</p>
</section>
......@@ -50,11 +42,7 @@
</p>
<p class="stable">
<i class="fas fa-file-download"></i>
{% assign release = site.static_files | where: "release", "macosx" | first %}
{% assign version = release.name | split: '-' %}
{% assign version = version[1] | split: release.extname | first %}
<a href="https://www.dynare.org/release/macosx/{{ release.name }}">Dynare {{ version }} ({{ release.extname }})</a>
<a href="https://www.dynare.org/release/macosx/{{ release.name }}.sig">[signature]</a>
{% include release/download-release-macosx.html %}
</p>
</section>
......@@ -86,11 +74,7 @@
</p>
<p class="stable">
<i class="fas fa-file-download"></i>
{% assign release = site.static_files | where: "release", "source" | first %}
{% assign version = release.name | split: '-' %}
{% assign version = version[1] | split: '.tar.' | first %}
<a href="https://www.dynare.org/release/source/{{ release.name }}">Dynare {{ version }} (.tar{{ release.extname }})</a>
<a href="https://www.dynare.org/release/source/{{ release.name }}.sig">[signature]</a>
{% include release/download-release-source.html %}
</p>
</section>
</div>
......
......@@ -2,7 +2,7 @@
set -e
cd assets
cd _includes
for branch in release snapshot
do
......@@ -18,21 +18,48 @@ do
for dir in "${arr[@]}"
do
mkdir -p "$dir"
readarray -t filenames < <(jq .[].filename "$dir.json")
readarray -t timestamps < <(jq .[].date "$dir.json")
if [[ "$OSTYPE" == "darwin"* ]]; then
filenames=(`jq .[].filename $dir.json`)
timestamps=(`jq .[].date $dir.json`)
else
readarray -t filenames < <(jq .[].filename "$dir.json")
readarray -t timestamps < <(jq .[].date "$dir.json")
fi
n=$(jq length "$dir.json")
cd "$dir"
includeFilename="download-$branch-$dir.html"
echo "" > $includeFilename
for ((i = 0; i < n; i++))
do
filename="${filenames[i]%\"}"
filename="${filename#\"}"
timestamp="${timestamps[i]%\"}"
timestamp="${timestamp#\"}"
echo "$filename $timestamp"
touch -amt "$timestamp" "$filename"
if [ "$branch" = "release" ]; then
IFS='-' read -ra split <<< "$filename"
if [ "$dir" = "windows" ] || [ "$dir" = "windows-zip" ]; then
version="${split[1]}"
ext=${filename##*.}
elif [ "$dir" = "macosx" ]; then
version=${split[1]%.*}
ext=${filename##*.}
else
ext=`echo ${split[1]} | rev | cut -d. -f2 -f1 | rev`
version=`echo ${split[1]} | cut -d. -f1 -f2 -f3`
fi
echo "<a href=\"https://www.dynare.org/$branch/$dir/$filename\">Dynare $version ($ext)</a>" >> $includeFilename
echo "<a href=\"https://www.dynare.org/$branch/$dir/$filename.sig\">[signature]</a>" >> $includeFilename
else
timestamp="${timestamps[i]%\"}"
timestamp="${timestamp#\"}"
if [[ "$OSTYPE" == "darwin"* ]]; then
datestr=`date -r $timestamp`
else
datestr=`date -d @$timestamp`
fi
echo "<div class=\"download_row\" onclick=\"document.location = 'https://www.dynare.org/$branch/$dir/$filename'\" onkeypress=\"document.location = 'https://www.dynare.org/$branch/$dir/$filename'\">" >> $includeFilename
echo " <div class=\"download_cell_left\"><i class=\"fas fa-file-download\"></i>&nbsp;$datestr</div>" >> $includeFilename
echo " <div class=\"download_cell_right\"><a href=\"#\">$filename</a></div>" >> $includeFilename
echo "</div>" >> $includeFilename
fi
done
cd ..
done
rm -- *.json
cd ..
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment