aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoris2024-01-03 00:01:38 +0100
committerJoris2024-01-03 00:01:38 +0100
commitb5292689534c00918675223d1f36174bbf44406f (patch)
treed2f70d1ce44b3647c143a2f43926a97203e259e0 /src
parent9c71ea5a80eed021cfc1a269a9a176b059eb8d4f (diff)
Provide tonality and selector to change
Diffstat (limited to 'src')
-rw-r--r--src/main.lisp26
1 files changed, 20 insertions, 6 deletions
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
- "<!doctype html><html lang=\"fr\"><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width\"><title>~A</title><link rel=\"stylesheet\" href=\"/main.css\"><link rel=\"icon\" href=\"/icon.png\">~A"
+ "<!doctype html><html lang=\"fr\"><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width\"><title>~A</title><link rel=\"stylesheet\" href=\"/main.css\"><link rel=\"icon\" href=\"/icon.png\">~A<script src=\"/main.js\"></script>"
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")