Style section headers

This commit is contained in:
Jeremy Dormitzer 2019-06-01 11:47:47 -04:00
parent a63f41c2ef
commit a7d486f090
3 changed files with 11 additions and 3 deletions

View File

@ -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. Its a book about algorithmic music, which is awesome because: a) Ive 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.

View File

@ -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

View File

@ -71,3 +71,7 @@ pre > code.hljs {
float: left;
margin-right: 1em;
}
.section-header {
margin-top: 2em;
}