|
4 | 4 | {{ $mainSoftwarePage := site.GetPage "neuromorphic-computing/software" }}
|
5 | 5 | {{ $isMainSoftwarePage := eq . $mainSoftwarePage }}
|
6 | 6 |
|
7 |
| - {{ $allSoftwarePages := where site.RegularPages "Params.type" "neuromorphic-software" }} |
| 7 | + {{/* Correctly filter pages based on the current context */}} |
| 8 | + {{ $pagesToList := slice }} |
| 9 | + {{ if $isMainSoftwarePage }} |
| 10 | + {{ $pagesToList = where site.RegularPages "Type" "neuromorphic-software" }} |
| 11 | + {{ else }} |
| 12 | + {{ $pagesToList = .Pages }} |
| 13 | + {{ end }} |
8 | 14 |
|
9 |
| - {{/* Augment pages with star count for sorting */}} |
| 15 | + {{/* Augment the correctly filtered pages with star count for sorting */}} |
10 | 16 | {{ $pagesWithStars := slice }}
|
11 |
| - {{ range $allSoftwarePages }} |
12 |
| - {{ $is_github := false }} |
13 |
| - {{ $repo_id := "" }} |
14 |
| - {{ with .Params.source_code }} |
15 |
| - {{ if in . "github.com" }} |
16 |
| - {{ $is_github = true }} |
17 |
| - {{ $repo_id = replace . "https://github.com/" "" }} |
18 |
| - {{ $repo_id = replace $repo_id ".git" "" }} |
19 |
| - {{ end }} |
20 |
| - {{ end }} |
| 17 | + {{ range $pagesToList }} |
| 18 | + {{ $is_github := false }} |
| 19 | + {{ $repo_id := "" }} |
| 20 | + {{ with .Params.source_code }} |
| 21 | + {{ if in . "github.com" }} |
| 22 | + {{ $is_github = true }} |
| 23 | + {{ $repo_id = replace . "https://github.com/" "" }} |
| 24 | + {{ $repo_id = replace $repo_id ".git" "" }} |
| 25 | + {{ end }} |
| 26 | + {{ end }} |
21 | 27 |
|
22 |
| - {{ $stars := 0 }} |
23 |
| - {{ if isset .Params "stars" }} |
24 |
| - {{ $stars = .Params.stars }} |
25 |
| - {{ else if and $is_github (ne $repo_id "") site.Data.github_stars }} |
26 |
| - {{ with index site.Data.github_stars $repo_id }} |
27 |
| - {{ $stars = . }} |
28 |
| - {{ end }} |
29 |
| - {{ end }} |
| 28 | + {{ $stars := 0 }} |
| 29 | + {{ if isset .Params "stars" }} |
| 30 | + {{ $stars = .Params.stars }} |
| 31 | + {{ else if and $is_github (ne $repo_id "") site.Data.github_stars }} |
| 32 | + {{ with index site.Data.github_stars $repo_id }} |
| 33 | + {{ $stars = . }} |
| 34 | + {{ end }} |
| 35 | + {{ end }} |
30 | 36 |
|
31 |
| - {{ $pagesWithStars = $pagesWithStars | append (dict "Page" . "Stars" $stars) }} |
| 37 | + {{ $pagesWithStars = $pagesWithStars | append (dict "Page" . "Stars" $stars) }} |
32 | 38 | {{ end }}
|
33 | 39 |
|
34 | 40 | {{ $sortedSoftwarePages := sort $pagesWithStars "Stars" "desc" }}
|
35 | 41 |
|
36 | 42 | {{ range $sortedSoftwarePages }}
|
37 |
| - {{ $page := .Page }} |
38 |
| - |
39 |
| - {{ $displayPage := false }} |
40 |
| - {{ if $isMainSoftwarePage }} |
41 |
| - {{ $displayPage = true }} |
42 |
| - {{ else }} |
43 |
| - {{ if $page.IsDescendant $mainSoftwarePage }} |
44 |
| - {{ $displayPage = true }} |
45 |
| - {{ end }} |
46 |
| - {{ end }} |
47 |
| - |
48 |
| - {{ if $displayPage }} |
49 |
| - <li class="mb-6 content-panel p-6 shadow-lg rounded-lg"> |
50 |
| - <div class="flex flex-col sm:flex-row items-start sm:items-center justify-between gap-2 mb-3"> |
51 |
| - <h3 class="text-xl font-bold"> |
52 |
| - <a href="{{ $page.Permalink }}" class="text-dark dark:text-darkmode-dark hover:text-primary dark:hover:text-darkmode-primary">{{ $page.Title }}</a> |
53 |
| - </h3> |
54 |
| - <div class="flex items-center space-x-2 flex-shrink-0"> |
55 |
| - {{ $repo_path := "" }} |
56 |
| - {{ $is_github := false }} |
57 |
| - {{ $is_gitlab := false }} |
58 |
| - {{ with $page.Params.source_code }} |
59 |
| - {{ if in . "github.com" }} |
60 |
| - {{ $is_github = true }} |
61 |
| - {{ $repo_path = replace . "https://github.com/" "" }} |
62 |
| - {{ else if in . "gitlab.com" }} |
63 |
| - {{ $is_gitlab = true }} |
64 |
| - {{ $repo_path = replace . "https://gitlab.com/" "" }} |
65 |
| - {{ end }} |
66 |
| - {{ $repo_path = replace $repo_path ".git" "" }} |
67 |
| - {{ end }} |
| 43 | + {{ $page := .Page }} |
| 44 | + <li class="mb-6 content-panel p-6 shadow-lg rounded-lg"> |
| 45 | + <div class="flex flex-col sm:flex-row items-start sm:items-center justify-between gap-2 mb-3"> |
| 46 | + <h3 class="text-xl font-bold"> |
| 47 | + <a href="{{ $page.Permalink }}" class="text-dark dark:text-darkmode-dark hover:text-primary dark:hover:text-darkmode-primary">{{ $page.Title }}</a> |
| 48 | + </h3> |
| 49 | + <div class="flex items-center space-x-2 flex-shrink-0"> |
| 50 | + {{ $repo_path := "" }} |
| 51 | + {{ $is_github := false }} |
| 52 | + {{ $is_gitlab := false }} |
| 53 | + {{ with $page.Params.source_code }} |
| 54 | + {{ if in . "github.com" }} |
| 55 | + {{ $is_github = true }} |
| 56 | + {{ $repo_path = replace . "https://github.com/" "" }} |
| 57 | + {{ else if in . "gitlab.com" }} |
| 58 | + {{ $is_gitlab = true }} |
| 59 | + {{ $repo_path = replace $repo_path "https://gitlab.com/" "" }} |
| 60 | + {{ end }} |
| 61 | + {{ $repo_path = replace $repo_path ".git" "" }} |
| 62 | + {{ end }} |
68 | 63 |
|
69 |
| - {{ if $page.Params.version_badge_url_override }} |
70 |
| - <img class="h-5" src="{{ $page.Params.version_badge_url_override }}" alt="Version Badge"> |
71 |
| - {{ else if $page.Params.pypi_id }} |
72 |
| - <img class="h-5" src="https://img.shields.io/pypi/v/{{ $page.Params.pypi_id }}.svg" alt="PyPI Version"> |
73 |
| - {{ else if $is_github }} |
74 |
| - <img class="h-5" src="https://img.shields.io/github/v/release/{{ $repo_path }}" alt="GitHub Release"> |
75 |
| - {{ end }} |
| 64 | + {{ if $page.Params.version_badge_url_override }} |
| 65 | + <img class="h-5" src="{{ $page.Params.version_badge_url_override }}" alt="Version Badge"> |
| 66 | + {{ else if $page.Params.pypi_id }} |
| 67 | + <img class="h-5" src="https://img.shields.io/pypi/v/{{ $page.Params.pypi_id }}.svg" alt="PyPI Version"> |
| 68 | + {{ else if $is_github }} |
| 69 | + <img class="h-5" src="https://img.shields.io/github/v/release/{{ $repo_path }}" alt="GitHub Release"> |
| 70 | + {{ end }} |
76 | 71 |
|
77 |
| - {{ if $is_github }} |
78 |
| - <img class="h-5" src="https://img.shields.io/github/stars/{{ $repo_path }}.svg?style=social" alt="GitHub Stars"> |
79 |
| - {{ else if $is_gitlab }} |
80 |
| - <img class="h-5" src="https://img.shields.io/gitlab/stars/{{ $repo_path }}.svg?style=social" alt="GitLab Stars"> |
81 |
| - {{ end }} |
| 72 | + {{ if $is_github }} |
| 73 | + <img class="h-5" src="https://img.shields.io/github/stars/{{ $repo_path }}.svg?style=social" alt="GitHub Stars"> |
| 74 | + {{ else if $is_gitlab }} |
| 75 | + <img class="h-5" src="https://img.shields.io/gitlab/stars/{{ $repo_path }}.svg?style=social" alt="GitLab Stars"> |
| 76 | + {{ end }} |
| 77 | + </div> |
82 | 78 | </div>
|
83 |
| - </div> |
84 | 79 |
|
85 |
| - <p class="mb-4 text-text dark:text-darkmode-text">{{ $page.Params.description }}</p> |
| 80 | + <p class="mb-4 text-text dark:text-darkmode-text">{{ $page.Params.description }}</p> |
86 | 81 |
|
87 |
| - <div class="border-t border-border dark:border-darkmode-border pt-4 flex flex-col sm:flex-row items-center justify-between gap-4"> |
| 82 | + <div class="border-t border-border dark:border-darkmode-border pt-4 flex flex-col sm:flex-row items-center justify-between gap-4"> |
88 | 83 |
|
89 |
| - <div class="flex items-center gap-3"> |
90 |
| - {{ with $page.Params.maintainer }} |
91 |
| - {{ $maintainerList := . }} |
92 |
| - {{ if not (reflect.IsSlice .) }}{{ $maintainerList = slice . }}{{ end }} {{/* Unify to a slice */}} |
| 84 | + <div class="flex items-center gap-3"> |
| 85 | + {{ with $page.Params.maintainer }} |
| 86 | + {{ $maintainerList := . }} |
| 87 | + {{ if not (reflect.IsSlice .) }}{{ $maintainerList = slice . }}{{ end }} {{/* Unify to a slice */}} |
93 | 88 |
|
94 |
| - <div class="flex -space-x-3"> |
95 |
| - {{ range $maintainerList }} |
96 |
| - {{ $maintainerName := . }} |
97 |
| - {{ $nameForProcessing := $maintainerName | replaceRE "[.]" "" | replaceRE "ć" "c" | replaceRE "Ć" "C" }} |
98 |
| - {{ $contributorSlug := $nameForProcessing | anchorize }} |
99 |
| - {{ $contributorPage := $page.Site.GetPage (printf "contributors/%s" $contributorSlug) }} |
100 |
| - {{ if and $contributorPage $contributorPage.Params.image }} |
101 |
| - {{ with $contributorPage.Resources.GetMatch $contributorPage.Params.image }} |
102 |
| - {{ $thumb := .Fill "40x40 Lanczos" }} |
103 |
| - <img src="{{ $thumb.RelPermalink }}" alt="{{ $maintainerName }}" title="{{ $maintainerName }}" class="w-10 h-10 rounded-full object-cover border-2 border-white dark:border-gray-800"> |
104 |
| - {{ end }} |
105 |
| - {{ else }} |
106 |
| - <div class="w-10 h-10 rounded-full bg-gray-200 dark:bg-darkmode-theme-dark flex items-center justify-center text-gray-400 border-2 border-white dark:border-gray-800" title="{{ $maintainerName }}"> |
107 |
| - {{ partial "icon.html" (dict "style" "solid" "name" "user" "class" "text-lg") }} |
108 |
| - </div> |
| 89 | + <div class="flex -space-x-3"> |
| 90 | + {{ range $maintainerList }} |
| 91 | + {{ $maintainerName := . }} |
| 92 | + {{ $nameForProcessing := $maintainerName | replaceRE "[.]" "" | replaceRE "ć" "c" | replaceRE "Ć" "C" }} |
| 93 | + {{ $contributorSlug := $nameForProcessing | anchorize }} |
| 94 | + {{ $contributorPage := $page.Site.GetPage (printf "contributors/%s" $contributorSlug) }} |
| 95 | + {{ if and $contributorPage $contributorPage.Params.image }} |
| 96 | + {{ with $contributorPage.Resources.GetMatch $contributorPage.Params.image }} |
| 97 | + {{ $thumb := .Fill "40x40 Lanczos" }} |
| 98 | + <img src="{{ $thumb.RelPermalink }}" alt="{{ $maintainerName }}" title="{{ $maintainerName }}" class="w-10 h-10 rounded-full object-cover border-2 border-white dark:border-gray-800"> |
| 99 | + {{ end }} |
| 100 | + {{ else }} |
| 101 | + <div class="w-10 h-10 rounded-full bg-gray-200 dark:bg-darkmode-theme-dark flex items-center justify-center text-gray-400 border-2 border-white dark:border-gray-800" title="{{ $maintainerName }}"> |
| 102 | + {{ partial "icon.html" (dict "style" "solid" "name" "user" "class" "text-lg") }} |
| 103 | + </div> |
| 104 | + {{ end }} |
| 105 | + {{ end }} |
| 106 | + </div> |
| 107 | + <div> |
| 108 | + <p class="text-xs text-text dark:text-darkmode-text">Maintained by</p> |
| 109 | + <p class="font-semibold text-primary dark:text-darkmode-primary"> |
| 110 | + {{ $links := slice }} |
| 111 | + {{ range $maintainerList }} |
| 112 | + {{ $nameForProcessing := . | replaceRE "[.]" "" | replaceRE "ć" "c" | replaceRE "Ć" "C" }} |
| 113 | + {{ $contributorSlug := $nameForProcessing | anchorize }} |
| 114 | + {{ $contributorPage := $page.Site.GetPage (printf "contributors/%s" $contributorSlug) }} |
| 115 | + {{ if $contributorPage }} |
| 116 | + {{ $links = $links | append (printf `<a href="%s">%s</a>` $contributorPage.RelPermalink .) }} |
| 117 | + {{ else }} |
| 118 | + {{ $links = $links | append (printf `<span>%s</span>` .) }} |
| 119 | + {{ end }} |
| 120 | + {{ end }} |
| 121 | + {{ delimit $links ", " | safeHTML }} |
| 122 | + </p> |
| 123 | + </div> |
109 | 124 | {{ end }}
|
110 |
| - {{ end }} |
111 |
| - </div> |
112 |
| - <div> |
113 |
| - <p class="text-xs text-text dark:text-darkmode-text">Maintained by</p> |
114 |
| - <p class="font-semibold text-primary dark:text-darkmode-primary"> |
115 |
| - {{ $links := slice }} |
116 |
| - {{ range $maintainerList }} |
117 |
| - {{ $nameForProcessing := . | replaceRE "[.]" "" | replaceRE "ć" "c" | replaceRE "Ć" "C" }} |
118 |
| - {{ $contributorSlug := $nameForProcessing | anchorize }} |
119 |
| - {{ $contributorPage := $page.Site.GetPage (printf "contributors/%s" $contributorSlug) }} |
120 |
| - {{ if $contributorPage }} |
121 |
| - {{ $links = $links | append (printf `<a href="%s">%s</a>` $contributorPage.RelPermalink .) }} |
122 |
| - {{ else }} |
123 |
| - {{ $links = $links | append (printf `<span>%s</span>` .) }} |
124 |
| - {{ end }} |
125 |
| - {{ end }} |
126 |
| - {{ delimit $links ", " | safeHTML }} |
127 |
| - </p> |
128 | 125 | </div>
|
129 |
| - {{ end }} |
130 |
| - </div> |
131 | 126 |
|
132 |
| - <div class="flex items-center gap-4"> |
133 |
| - <div class="flex flex-wrap gap-2"> |
134 |
| - {{ if $page.Params.supports_NIR }}<span class="support-badge">NIR Support</span>{{ end }} |
135 |
| - {{ if $page.Params.supports_hardware }}<span class="support-badge">Hardware Support</span>{{ end }} |
| 127 | + <div class="flex items-center gap-4"> |
| 128 | + <div class="flex flex-wrap gap-2"> |
| 129 | + {{ if $page.Params.supports_NIR }}<span class="support-badge">NIR Support</span>{{ end }} |
| 130 | + {{ if $page.Params.supports_hardware }}<span class="support-badge">Hardware Support</span>{{ end }} |
| 131 | + </div> |
| 132 | + <a href="{{ $page.Permalink }}" class="btn btn-new-outline btn-sm !py-2 !px-4 flex-shrink-0">View Details</a> |
136 | 133 | </div>
|
137 |
| - <a href="{{ $page.Permalink }}" class="btn btn-new-outline btn-sm !py-2 !px-4 flex-shrink-0">View Details</a> |
138 | 134 | </div>
|
139 |
| - </div> |
140 |
| - </li> |
141 |
| - {{ end }} |
| 135 | + </li> |
142 | 136 | {{ end }}
|
143 | 137 | </ul>
|
144 | 138 | </div>
|
0 commit comments