From 2e6f266948bda4d4b08c9b88e14eeaeb284f137a Mon Sep 17 00:00:00 2001 From: Joris Date: Thu, 4 Jan 2024 21:03:03 +0100 Subject: Specify chord duration --- src/main.lisp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/main.lisp b/src/main.lisp index f3bd32e..d7dec7f 100644 --- a/src/main.lisp +++ b/src/main.lisp @@ -76,18 +76,25 @@ ; Chords -(defun chord-div (chord) - (h "span" '(("class" "g-Chords__Chord")) (list (string chord)))) +(defun rhythm (x) + (h "img" (list '("class" "g-Chords__Rhythm") (list "src" (format nil "/rhythms/~S.png" x))) nil)) -(defun chord-cell (chords) +(defun chord-div (x) + (h "span" '(("class" "g-Chords__Chord")) + (if + (listp x) + (cons (string (car x)) (mapcar #'rhythm (cdr x))) + (list (string x))))) + +(defun chord-cell (x) (h "td" '(("class" "g-Chords__Cell")) (if - (listp chords) - (mapcar #'chord-div chords) - (list (chord-div chords))))) + (listp x) + (mapcar #'chord-div x) + (list (chord-div x))))) -(defun chord-row (chords) - (h "tr" nil (mapcar #'chord-cell chords))) +(defun chord-row (xs) + (h "tr" nil (mapcar #'chord-cell xs))) (defun chord-rows (xs) (if -- cgit v1.2.3