Compare commits
	
		
			3 Commits
		
	
	
		
			dc12db07a2
			...
			ff8d9c80e6
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| ff8d9c80e6 | |||
| 842b66def0 | |||
| bfc158c6cb | 
| @@ -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 | ||||
|         run: make pdf html songbook | ||||
|  | ||||
|       - name: Build Zola | ||||
|         run: zola build | ||||
|   | ||||
							
								
								
									
										2
									
								
								makefile
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								makefile
									
									
									
									
									
								
							| @@ -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 := songbook.pdf | ||||
| SONGBOOK := content/songbook.pdf | ||||
|  | ||||
| .DEFAULT_GOAL := pdf | ||||
|  | ||||
|   | ||||
| @@ -20,15 +20,21 @@ function buttonToggle(clickedButton) { | ||||
| } | ||||
|  | ||||
| function filterSongs() { | ||||
| 	const searchTerm = search.value.trim().toLowerCase().normalize("NFD").replace(/\p{Diacritic}/gu, ""); | ||||
| 	const searchTerm = sanitizeString(search.value); | ||||
| 	const songs = Array.from(songList.children); | ||||
| 	songs.forEach(song => { | ||||
| 		const title = song.dataset.title.toLowerCase().normalize("NFD").replace(/\p{Diacritic}/gu, ""); | ||||
| 		const matching = title.includes(searchTerm) && (!selectedCategory || song.dataset.category === selectedCategory); | ||||
| 		const matching = ( | ||||
| 			(song.dataset.title.includes(searchTerm) || (song.dataset.artist && song.dataset.artist.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 | ||||
| @@ -37,7 +43,10 @@ buttons.forEach(button => button.addEventListener("click", () => buttonToggle(bu | ||||
|  | ||||
| // Normalize song titles | ||||
| Array.from(songList.children).forEach(song => { | ||||
| 	song.dataset.title = song.dataset.title.toLowerCase().normalize("NFD").replace(/\p{Diacritic}/gu, ""); | ||||
| 	song.dataset.title = sanitizeString(song.dataset.title); | ||||
| 	if (song.dataset.artist) { | ||||
| 		song.dataset.artist = sanitizeString(song.dataset.artist); | ||||
| 	} | ||||
| }); | ||||
|  | ||||
| // Display the filter section on JS-enabled browsers | ||||
|   | ||||
| @@ -21,7 +21,13 @@ | ||||
| 		</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) }}"> | ||||
| 				<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="meta"> | ||||
| 						<div class="title">{{ song.title }}</div> | ||||
| 						{% if song.taxonomies["artist"] %} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user