From b5292689534c00918675223d1f36174bbf44406f Mon Sep 17 00:00:00 2001 From: Joris Date: Wed, 3 Jan 2024 00:01:38 +0100 Subject: Provide tonality and selector to change --- src/main.lisp | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/main.lisp b/src/main.lisp index 1afc4f9..f03bd1a 100644 --- a/src/main.lisp +++ b/src/main.lisp @@ -32,7 +32,7 @@ (defun page (title body) (format nil - "~A~A" + "~A~A" title body)) @@ -75,8 +75,18 @@ ; Chords +(defun chord-div (chord) + (h "span" '(("class" "g-Chords__Chord")) (list (string chord)))) + +(defun chord-cell (chords) + (h "td" '(("class" "g-Chords__Cell")) + (if + (listp chords) + (mapcar #'chord-div chords) + (list (chord-div chords))))) + (defun chord-row (chords) - (h "tr" nil (mapcar (lambda (x) (h "td" nil (list (string x)))) chords))) + (h "tr" nil (mapcar #'chord-cell chords))) (defun chord-rows (xs) (if @@ -87,7 +97,7 @@ (defun chord-table (key row) (part-tags key - (h "table" '(("class" "g-Chords")) (chord-rows row)))) + (h "table" '(("class" "g-Chords__Table")) (chord-rows row)))) (defun chord-tables (xs) (if @@ -97,11 +107,14 @@ (rows (cdr (car xs)))) (cons (chord-table key rows) (chord-tables (cdr xs)))))) -(defun chord-tags (chords) +(defun chord-tags (chords tonality) (h "section" nil (list (h "h2" '(("class" "g-Subtitle")) '("Accords")) - (h "div" '(("class" "g-Parts")) (chord-tables chords))))) + (h "div" '(("class" "g-Parts")) + (cons + (h "div" (list (list "data-tonality" tonality)) nil) + (chord-tables chords)))))) ; Lyrics @@ -134,6 +147,7 @@ (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)))) (write-file output (page @@ -144,7 +158,7 @@ (list (h "a" '(("class" "g-Back") ("href" "/")) '("Retour à l’accueil")) (title-tags title from) - (chord-tags chords) + (chord-tags chords tonality) (lyrics-tags lyrics)))))))) (export-song "songs/graeme-allwright/petit-garcon.lisp") -- cgit v1.2.3