diff --git a/src/blog/a-dsl-for-music.html.pm b/src/blog/a-dsl-for-music.html.pm index f0d70fb..b9d1b57 100644 --- a/src/blog/a-dsl-for-music.html.pm +++ b/src/blog/a-dsl-for-music.html.pm @@ -3,8 +3,6 @@ ◊title{A DSL for Music} ◊published-date[2018 8 5] -◊;; TODO add author and date - ◊section{Haskell School of Music} I recently discovered Haskell School of Music. It’s a book about algorithmic music, which is awesome because: a) I’ve been obsessed with procedural generation for years and b) I like music as much as I like programming. So you can imagine my excitement when I discovered that someone had written a textbook combining my favorite areas of study. diff --git a/src/pollen.rkt b/src/pollen.rkt index dd48a4e..e9fa536 100644 --- a/src/pollen.rkt +++ b/src/pollen.rkt @@ -11,6 +11,12 @@ (define (zip-kws kws kw-args) (map list (map string->symbol (map keyword->string kws)) kw-args)) +(define (with-class attrs cls) + (let ((existing-cls (assoc 'class attrs))) + (dict-set attrs 'class (if existing-cls + (list (string-append (cadr existing-cls) " " cls)) + (list cls))))) + (define title (make-keyword-procedure (lambda (kws kw-args . elements) @@ -19,7 +25,7 @@ (define section (make-keyword-procedure (lambda (kws kw-args . elements) - (txexpr 'h2 (zip-kws kws kw-args) elements)))) + (txexpr 'h2 (with-class (zip-kws kws kw-args) "section-header") elements)))) (define link (make-keyword-procedure diff --git a/src/stylesheet.css.pp b/src/stylesheet.css.pp index 5bf616d..efc8f9b 100644 --- a/src/stylesheet.css.pp +++ b/src/stylesheet.css.pp @@ -71,3 +71,7 @@ pre > code.hljs { float: left; margin-right: 1em; } + +.section-header { + margin-top: 2em; +}