Compare commits

..

No commits in common. "ff8d9c80e6b5e65a80505f0b830f48cc20cae657" and "dc12db07a2be676519a396b8d682ba332bee6cb9" have entirely different histories.

4 changed files with 7 additions and 22 deletions

View File

@ -22,7 +22,7 @@ jobs:
run: git clone https://git.0x45.cz/em/mixtape.git /workspace/em/mixtape
- name: Build Chordpro
run: make pdf html songbook
run: make pdf html
- name: Build Zola
run: zola build

View File

@ -10,7 +10,7 @@ SRC_EXTENSION := .cho
SONG_CHO := $(foreach dir,$(SRC_DIR),$(wildcard $(dir)/*$(SRC_EXTENSION)))
SONG_PDF := $(patsubst %$(SRC_EXTENSION),%.pdf,$(SONG_CHO))
SONG_HTML := $(patsubst %$(SRC_EXTENSION),%.html,$(SONG_CHO))
SONGBOOK := content/songbook.pdf
SONGBOOK := songbook.pdf
.DEFAULT_GOAL := pdf

View File

@ -20,21 +20,15 @@ function buttonToggle(clickedButton) {
}
function filterSongs() {
const searchTerm = sanitizeString(search.value);
const searchTerm = search.value.trim().toLowerCase().normalize("NFD").replace(/\p{Diacritic}/gu, "");
const songs = Array.from(songList.children);
songs.forEach(song => {
const matching = (
(song.dataset.title.includes(searchTerm) || (song.dataset.artist && song.dataset.artist.includes(searchTerm))) &&
(!selectedCategory || song.dataset.category === selectedCategory)
);
const title = song.dataset.title.toLowerCase().normalize("NFD").replace(/\p{Diacritic}/gu, "");
const matching = title.includes(searchTerm) && (!selectedCategory || song.dataset.category === selectedCategory);
song.classList.toggle("hidden", !matching);
});
}
function sanitizeString(string) {
return string.trim().toLowerCase().normalize("NFD").replace(/\p{Diacritic}/gu, "")
}
// Event listeners
search.addEventListener("input", filterSongs);
// Filtering happens before the reset itself without this timeout
@ -43,10 +37,7 @@ buttons.forEach(button => button.addEventListener("click", () => buttonToggle(bu
// Normalize song titles
Array.from(songList.children).forEach(song => {
song.dataset.title = sanitizeString(song.dataset.title);
if (song.dataset.artist) {
song.dataset.artist = sanitizeString(song.dataset.artist);
}
song.dataset.title = song.dataset.title.toLowerCase().normalize("NFD").replace(/\p{Diacritic}/gu, "");
});
// Display the filter section on JS-enabled browsers

View File

@ -21,13 +21,7 @@
</section>
<section class="song-list">
{% for song in section.pages %}
<div class="{{ macros::primary_category(song=song) }}"
data-title="{{ song.title }}"
data-category="{{ macros::primary_category(song=song) }}"
{% if song.taxonomies["artist"] %}
data-artist="{{ song.taxonomies["artist"][0] }}"
{% endif %}
>
<div class="{{ macros::primary_category(song=song) }}" data-title="{{ song.title }}" data-category="{{ macros::primary_category(song=song) }}">
<div class="meta">
<div class="title">{{ song.title }}</div>
{% if song.taxonomies["artist"] %}