Skip to content

Commit

Permalink
Improve table
Browse files Browse the repository at this point in the history
  • Loading branch information
nroduit committed May 12, 2024
1 parent 515ec4d commit 3026277
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 59 deletions.
2 changes: 1 addition & 1 deletion config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ keepWhitespace = false
[caches]
[caches.getjson]
dir = ":cacheDir/:project"
maxAge = "10s"
maxAge = "300s"

[outputFormats]
[outputFormats.API]
Expand Down
82 changes: 41 additions & 41 deletions layouts/shortcodes/latest-download.html
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
{{$type := .Get 0}}
{{ $url := "https://api.github.com/repos/nroduit/Weasis/releases/latest" }}
{{ $jfile := getJSON $url }}
<table>
<caption>Download Weasis DICOM Viewer binaries</caption>
<thead>
<tr>
<th style="text-align: center; width: 10%;" scope="col">System</th>
<th style="text-align: center; width: 10%;" scope="col">Architecture</th>
<th style="text-align: center; width: 5%;" scope="col">Package</th>
<th style="text-align: center; width: 8%;" scope="col">Size</th>
<th style="text-align: center; width: 15%;" scope="col">Weasis installer</th>
<th style="text-align: center;" scope="col">Comments</th>
</tr>
</thead>
{{ range $elem_index, $elem_val := $jfile }}
{{ if (eq $elem_index "assets") }}
{{ range $burl, $val := sort $elem_val "content_type" }}
{{ $package := path.Ext $val.name }}
{{ if or (eq $package ".msi") (eq $package ".deb") (eq $package ".rpm") (eq $package ".pkg") }}
{{ $arch := printf "%s %s-bit" (cond (or (in $val.name "aarch") (in $val.name "arm")) "arm" "x86") (cond (or (in $val.name "64") (eq $package ".pkg") ) "64" "32") }}
{{ $system := cond (eq $package ".msi") "Windows" (cond (eq $package ".pkg") "macOS" "Linux") }}
{{ $icon := cond (eq $package ".msi") "microsoft" (cond (eq $package ".pkg") "apple" "linux") }}
<tr>
<td style="text-align: left;"><i class='fab fa-{{ $icon }}' style='font-size:24px'></i> {{ $system }}</td>
<td style="text-align: left;">{{ $arch }}</td>
<td style="text-align: left;">{{ upper ( substr $package 1 ) }}</td>
<td style="text-align: left;">{{ printf "%.1f MB" (div $val.size 1000000) }}</td>
<td style="text-align: left;">
<span class="btn cstyle transparent">
<a href="{{ $val.browser_download_url }}" target="_blank" rel="noopener noreferrer">{{ $val.name }} <i class="fa-fw fas fa-download"></i></a>
</span>
</td>
<td style="text-align: left;">{{ cond (eq $package ".msi") "Requires Windows 7 or higher"
(cond (eq $package ".pkg") (cond (eq $arch "arm 64-bit") "Requires macOS 11 or higher (Apple Silicon)" "Requires macOS 10.13 or higher" )
(cond (eq $arch "arm 32-bit") "Requires GLIBC_2.17. Only tested with Raspberry Pi 4"
(cond (eq $arch "arm 64-bit") "Requires GLIBC_2.27" (cond (eq $package ".rpm") "Requires GLIBC_2.17, libstdc++.so.6 and libgcc" "Requires GLIBC_2.17" ))))
}}
.<br>Checksum <span class="btn cstyle transparent"> <a href="{{ printf "%s.sha256" $val.browser_download_url }}" target="_blank" rel="noopener noreferrer">sha256<i class="fa-fw fas fa-download"></i></a></span>
</td>
</tr>
{{ end }}
<table style="font-size: 0.8em;">
<caption>Download Weasis DICOM Viewer binaries</caption>
<thead>
<tr>
<th style="text-align: center; width: 11%;" scope="col">System</th>
<th style="text-align: center; width: 7%;" scope="col">Arch.</th>
<th style="text-align: center; width: 5%;" scope="col">Pack.</th>
<th style="text-align: center; width: 8%;" scope="col">Size</th>
<th style="text-align: center; width: 30%;" scope="col">Weasis installer</th>
<th style="text-align: center;" scope="col">Comments</th>
</tr>
</thead>
{{ range $elem_index, $elem_val := $jfile }}
{{ if eq $elem_index "assets" }}
{{ range $burl, $val := sort $elem_val "content_type" }}
{{ $package := path.Ext $val.name }}
{{ if or (eq $package ".msi") (eq $package ".deb") (eq $package ".rpm") (eq $package ".pkg") }}
{{ $arch := printf "%s-%s" (cond (or (in $val.name "aarch") (in $val.name "arm")) "arm" "x86") (cond (or (in $val.name "64") (eq $package ".pkg") ) "64" "32") }}
{{ $system := cond (eq $package ".msi") "Windows" (cond (eq $package ".pkg") "macOS" "Linux") }}
{{ $icon := cond (eq $package ".msi") "microsoft" (cond (eq $package ".pkg") "apple" "linux") }}
<tr>
<td style="text-align: left;"><i class='fab fa-{{ $icon }}' style='font-size: 1.5em;'></i>&#160{{ $system }}</td>
<td style="text-align: left;">{{ $arch }}</td>
<td style="text-align: left;">{{ upper ( substr $package 1 ) }}</td>
<td style="text-align: left;">{{ printf "%.1f MB" (div $val.size 1000000) }}</td>
<td style="text-align: left;">
<span class="btn cstyle transparent">
<a href="{{ $val.browser_download_url }}" target="_blank" rel="noopener noreferrer" style='font-size: 0.8em;'>{{ $val.name }} <i class="fa-fw fas fa-download" style='font-size: 0.8em;'></i></a>
</span> <a href="{{ printf "%s.sha256" $val.browser_download_url }}" target="_blank" rel="noopener noreferrer">sha256</a>
</td>
<td style="text-align: left;">{{ cond (eq $package ".msi") "Requires Windows 7 or higher"
(cond (eq $package ".pkg") (cond (eq $arch "arm-64") "Requires macOS 11 or higher (Apple Silicon)" "Requires macOS 10.13 or higher" )
(cond (eq $arch "arm-32") "Requires GLIBC_2.17. Only tested with Raspberry Pi 4"
(cond (eq $arch "arm-64") "Requires GLIBC_2.27" (cond (eq $package ".rpm") "Requires GLIBC_2.17, libstdc++.so.6 and libgcc" "Requires GLIBC_2.17" ))))
}}
</td>
</tr>
{{ end }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}
</table>

34 changes: 17 additions & 17 deletions layouts/shortcodes/old-download.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{{ $url := "https://api.github.com/repos/nroduit/Weasis/releases" }}
{{ $jfile := getJSON $url }}
<table>
<table style="font-size: 0.8em;">
<caption>Download Weasis DICOM Viewer binaries</caption>
<thead>
<tr>
<th style="text-align: center; width: 10%;" scope="col">System</th>
<th style="text-align: center; width: 10%;" scope="col">Architecture</th>
<th style="text-align: center; width: 5%;" scope="col">Package</th>
<th style="text-align: center; width: 11%;" scope="col">System</th>
<th style="text-align: center; width: 7%;" scope="col">Arch.</th>
<th style="text-align: center; width: 5%;" scope="col">Pack.</th>
<th style="text-align: center; width: 8%;" scope="col">Size</th>
<th style="text-align: center; width: 15%;" scope="col">Weasis installer</th>
<th style="text-align: center; width: 30%;" scope="col">Weasis installer</th>
<th style="text-align: center;" scope="col">Comments</th>
</tr>
</thead>
Expand All @@ -26,27 +26,27 @@
{{ range $burl, $val := sort $rval "content_type" }}
{{ $package := path.Ext $val.name }}
{{ if or (eq $package ".msi") (eq $package ".deb") (eq $package ".rpm") (eq $package ".pkg") }}
{{ $arch := printf "%s %s-bit" (cond (or (in $val.name "aarch") (in $val.name "arm")) "arm" "x86") (cond (or (in $val.name "64") (eq $package ".pkg") ) "64" "32") }}
{{ $arch := printf "%s-%s" (cond (or (in $val.name "aarch") (in $val.name "arm")) "arm" "x86") (cond (or (in $val.name "64") (eq $package ".pkg") ) "64" "32") }}
{{ $system := cond (eq $package ".msi") "Windows" (cond (eq $package ".pkg") "macOS" "Linux") }}
{{ $icon := cond (eq $package ".msi") "microsoft" (cond (eq $package ".pkg") "apple" "linux") }}
<tr>
<td style="text-align: left;"><i class='fab fa-{{ $icon }}' style='font-size:24px'></i> {{ $system }}</td>
<td style="text-align: left;"><i class='fab fa-{{ $icon }}' style='font-size: 1.5em;'></i>&#160{{ $system }}</td>
<td style="text-align: left;">{{ $arch }}</td>
<td style="text-align: left;">{{ upper ( substr $package 1 ) }}</td>
<td style="text-align: left;">{{ printf "%.1f MB" (div $val.size 1000000) }}</td>
<td style="text-align: left;">{{ printf "%.1f MB" (div $val.size 1000000) }}</td>
<td style="text-align: left;">
<span class="btn cstyle transparent">
<a href="{{ $val.browser_download_url }}" target="_blank" rel="noopener noreferrer">{{ $val.name }} <i class="fa-fw fas fa-download"></i></a>
</span>
<span class="btn cstyle transparent">
<a href="{{ $val.browser_download_url }}" target="_blank" rel="noopener noreferrer" style='font-size: 0.8em;'>{{ $val.name }} <i class="fa-fw fas fa-download" style='font-size: 0.8em;'></i></a>
{{ $date := time "2024-05-01" }}
{{ if ge (time $elem_val.published_at) $date }}
</span> <a href="{{ printf "%s.sha256" $val.browser_download_url }}" target="_blank" rel="noopener noreferrer">sha256</a>
{{ end }}
</td>
<td style="text-align: left;">{{ cond ( ge $elem_index 1) "" (cond (eq $package ".msi") "Requires Windows 7 or higher"
(cond (eq $package ".pkg") (cond (eq $arch "arm 64-bit") "Requires macOS 11 or higher (Apple Silicon)" "Requires macOS 10.13 or higher" )
(cond (eq $arch "arm 32-bit") "Requires GLIBC_2.17. Only tested with Raspberry Pi 4"
(cond (eq $arch "arm 64-bit") "Requires GLIBC_2.27" (cond (eq $package ".rpm") "Requires GLIBC_2.17, libstdc++.so.6 and libgcc" "Requires GLIBC_2.17" )))))
(cond (eq $package ".pkg") (cond (eq $arch "arm-64") "Requires macOS 11 or higher (Apple Silicon)" "Requires macOS 10.13 or higher" )
(cond (eq $arch "arm-32") "Requires GLIBC_2.17. Only tested with Raspberry Pi 4"
(cond (eq $arch "arm-64") "Requires GLIBC_2.27" (cond (eq $package ".rpm") "Requires GLIBC_2.17, libstdc++.so.6 and libgcc" "Requires GLIBC_2.17" )))))
}}
{{ if ( eq $elem_index 0) }}
.<br>Checksum <span class="btn cstyle transparent"> <a href="{{ printf "%s.sha256" $val.browser_download_url }}" target="_blank" rel="noopener noreferrer">sha256<i class="fa-fw fas fa-download"></i></a></span>
{{ end }}
</td>
</tr>
{{ end }}
Expand Down

0 comments on commit 3026277

Please sign in to comment.