Skip to content

Commit e919bb7

Browse files
author
doomy
committed
better tagging
1 parent 4067a90 commit e919bb7

3 files changed

Lines changed: 18 additions & 8 deletions

File tree

content/crates.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,35 @@
11
[[crates]]
22
source = "crates"
33
key = "fundsp"
4+
tags = ["DSP"]
45

56
[[crates]]
67
source = "crates"
78
key = "cpal"
9+
tags = ["devices"]
810

911
[[crates]]
1012
source = "crates"
1113
key = "coremidi"
14+
tags = ["MIDI"]
1215

1316
[[crates]]
1417
source = "github"
1518
key = "wrl/baseplug"
19+
tags = ["framework","VST2"]
1620

1721
[[crates]]
1822
source = "github"
1923
key = "RustAudio/baseview"
24+
tags = ["windowing","GUI"]
2025

2126
[[crates]]
2227
source = "github"
2328
key = "robbert-vdh/nih-plug"
29+
tags = ["framework","VST3","CLAP"]
2430

2531
[[crates]]
2632
source = "github"
2733
key = "glowcoil/clap-sys"
34+
tags = ["bindings","CLAP"]
2835

sass/main.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ body {
7070
}
7171

7272
.tags {
73+
text-transform: capitalize;
7374
display: flex;
7475
flex-wrap: wrap;
7576
gap: 0.3em;

templates/index.html

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,19 @@ <h2>Audio crates</h2>
6565
{% set name = data.name %}
6666
{% set description = data.description %}
6767
{% set url = data.svn_url %}
68-
{% set keywords = data.topics %}
68+
{# {% set keywords = data.topics %} #}
6969

7070
{% elif source == "crates" %}
7171
{# Get crates API page to pull information #}
7272
{% set data = load_data(url="https://crates.io/api/v1/crates/"~crate.key, format="json") %}
7373
{% set name = data.crate.name %}
7474
{% set description = data.crate.description %}
7575
{% set url = "https://crates.io/crates/"~name %}
76-
{% set keywords = data.crate.keywords %}
76+
{# {% set keywords = data.crate.keywords %} #}
7777

7878
{% endif %}
7979

80-
<div class='crate' data-keywords='{{ keywords | join(sep=" ") }}'>
80+
<div class='crate' data-keywords='{{ crate.tags | join(sep=" ") }}'>
8181
<a target=" _blank" href={{url}}>
8282
<h4>
8383
<pre>{{ name }}</pre>
@@ -86,8 +86,8 @@ <h4>
8686
<p>{{ description }}</p>
8787

8888
<div class="tags">
89-
{% for keyword in keywords %}
90-
<span class="filter-tag tag" data-keyword={{keyword}}>{{keyword}}</span>
89+
{% for tag in crate.tags %}
90+
<span class="filter-tag tag" data-keyword={{tag}}>{{tag}}</span>
9191
{% endfor %}
9292
</div>
9393
{# <div class="details">
@@ -189,10 +189,12 @@ <h2>{{group | capitalize}}</h2>
189189
var filter_element = document.querySelector(".filters");
190190
var filters = [];
191191
[].forEach.call(tags, function (tag) {
192-
filters.push(tag.innerText)
192+
filters.push(tag.dataset.keyword)
193193
});
194194
// Dedup
195-
filters = [...new Set(filters)].sort();
195+
filters = [...new Set(filters)].sort(function (a, b) {
196+
return a.localeCompare(b);
197+
});
196198
enabled_filters = []
197199

198200
function build_filters() {
@@ -252,7 +254,7 @@ <h2>{{group | capitalize}}</h2>
252254
tags = document.querySelectorAll(".filter-tag");
253255
[].forEach.call(tags, function (tag) {
254256
tag.addEventListener("click", (ev) => {
255-
let keyword = tag.innerText;
257+
let keyword = tag.dataset.keyword;
256258
toggle_filter(keyword);
257259
});
258260
});

0 commit comments

Comments
 (0)