diff options
author | Joris | 2024-01-03 16:15:04 +0100 |
---|---|---|
committer | Joris | 2024-01-03 16:15:04 +0100 |
commit | 9d25bbc56ff1d3fe92c6ce596bff0cfc3adbf60e (patch) | |
tree | 4d87ca60cc1d2d8ae9c1e083041bde4587ac3512 /src | |
parent | dd0917047779f5db0788801d6e2963a12273de54 (diff) |
Generate index automatically
Diffstat (limited to 'src')
-rw-r--r-- | src/main.lisp | 48 |
1 files changed, 35 insertions, 13 deletions
diff --git a/src/main.lisp b/src/main.lisp index f03bd1a..f3bd32e 100644 --- a/src/main.lisp +++ b/src/main.lisp @@ -61,6 +61,7 @@ ('verse "Couplet") ('chorus "Refrain") ('interlude "Interlude") + ('bridge "Pont") ('outro "Outro"))) (defun part-tags (key children) @@ -113,7 +114,10 @@ (h "h2" '(("class" "g-Subtitle")) '("Accords")) (h "div" '(("class" "g-Parts")) (cons - (h "div" (list (list "data-tonality" tonality)) nil) + (h "label" '(("class" "g-Chords__Tonality")) + (list + "Tonalité :" + (h "span" '(("id" "g-Tonality")) (list (string tonality))))) (chord-tables chords)))))) ; Lyrics @@ -140,16 +144,16 @@ (h "h2" '(("class" "g-Subtitle")) '("Paroles")) (h "div" '(("class" "g-Parts")) (mapcar #'lyrics-section lyrics))))) -; Main +; Export songs (defun export-song (path) - (let ((data (with-open-file (in path) (read in)))) - (let ((output (concatenate 'string "public/" (car (split path #\.)) ".html")) - (title (car (song-key 'title (cdr data)))) - (from (car (song-key 'from (cdr data)))) - (tonality (car (song-key 'tonality (cdr data)))) - (chords (song-key 'chords (cdr data))) - (lyrics (song-key 'lyrics (cdr data)))) + (let* ((data (with-open-file (in path) (read in))) + (output (concatenate 'string "public/" (car (split path #\.)) ".html")) + (title (car (song-key 'title (cdr data)))) + (from (car (song-key 'from (cdr data)))) + (tonality (car (song-key 'tonality (cdr data)))) + (chords (song-key 'chords (cdr data))) + (lyrics (song-key 'lyrics (cdr data)))) (write-file output (page (format nil "~A – ~A" title from) (h @@ -159,8 +163,26 @@ (h "a" '(("class" "g-Back") ("href" "/")) '("Retour à l’accueil")) (title-tags title from) (chord-tags chords tonality) - (lyrics-tags lyrics)))))))) + (lyrics-tags lyrics))))))) -(export-song "songs/graeme-allwright/petit-garcon.lisp") -(export-song "songs/ben-e-king/stand-by-me.lisp") -(export-song "songs/tri-yann/pelot-d-hennebont.lisp") +(dolist (path (cdr *posix-argv*)) + (export-song path)) + +; Export index + +(write-file "public/index.html" (page + "Music" + (h + "body" + nil + (list + (h "h1" '(("class" "g-Title")) '("Music")) + (h "ul" '(("class" "g-Songs")) + (mapcar + (lambda (path) + (let* ((data (with-open-file (in path) (read in))) + (href (concatenate 'string (car (split path #\.)) ".html")) + (title (car (song-key 'title (cdr data)))) + (from (car (song-key 'from (cdr data))))) + (h "li" nil (list (h "a" (list (list "href" href)) (list (format nil "~A – ~A" from title))))))) + (cdr *posix-argv*))))))) |