;; -*- mode: owl; compile-command: "ol -i ~/*/owl/robusta/ reading.scm > reading-list.html" -*- (import (owl toplevel) (prefix (robusta encoding html) html/)) (define keywords '((author . "Author") (title . "Title") (orig-title . "Original title") (read-in . "Read in") (languages . "Languages (possibly more)") (isbn . "ISBN") (opinion . "Opinion") )) (define known-keywords (map car keywords)) (define-syntax book! (syntax-rules (=>) ((_) #n) ((_ key => val . rest) (if (has? known-keywords 'key) (append (list (cons 'key val)) (_ . rest)) (syntax-error "Unknown keyword: " key))))) (define reading-list (list (list 2024 (book! isbn => 9788367805148 author => "Maciej Lorenc" title => "Grzybobranie") (book! author => "Piotr Szwed" title => "Patrz trochę szerzej" isbn => 9788383800615) (book! author => "J.R.R. Tolkien" title => "Niedokończone opowieści" orig-title => "Unfinished Tales" languages => '(gb) isbn => 9788324140039) (book! author => "J.R.R. Tolkien" read-in => "Silesian" title => "Hobit, abo tam i nazŏd" languages => '(gb) orig-title => "The Hobbit or There and Back Again" isbn => 9788365558633) (book! author => "Rafał Kosik" title => "Kameleon" isbn => 9788361187059) (book! author => "Rafał Kosik" title => "Różaniec" isbn => 9788364384684) (book! author => "Marcin Bruczkowski" title => "Bezsenność w Tokio" isbn => 8389217511) (book! author => "J.R.R. Tolkien" title => "Silmarillion" orig-title => "The Silmarillion" languages => '(gb) isbn => 8307021723 read-in => "Polish") (book! title => "Cyberiada" author => "Stanisław Lem" languages => '(gb) isbn => 9788308055281) (book! title => "Metro 2033" read-in => "Polish" author => "Дмитрий Глуховский" orig-title => "Метро 2033" languages => '(ru gb) isbn => 9788365315014) (book! title => "Cudze słowa" author => "Wit Szostak" isbn => 9788366178380) (book! title => "Co robić przed końcem świata" author => "Tomasz Stawiszyński" isbn => 9788326845789) ) (list 2025 (book! author => "Paweł Reszka" title => "Stolik z widokiem na Kreml" isbn => 9788383600079) (book! author => "Олександр Бойченко" title => "50 procent racji" orig-title => "50 відсотків рації" languages => '(ua) read-in => "Polish" isbn => 9788364375187) (book! author => "Юрій Андрухович" title => "Leksykon miast intymnych" orig-title => "Лексикон інтимних міст" languages => '(ua) read-in => "Polish" isbn => 9788375365672) (book! author => "Douglas Adams" title => "Autostopem przez galaktykę" orig-title => "The Hitch-Hikers Guide to the Galaxy" languages => '(gb) read-in => "Polish" isbn => 9788382022018) (book! author => "Bartosz Józefiak" title => "Patodeweloperka. To nie jest kraj do mieszkania" isbn => 9788324083978) (book! author => "Marek Szymaniak" title => "Zapaść. Reportaże z mniejszych miast" isbn => 9788381912525) (book! author => "Douglas Adams" title => "Restauracja na końcu wszechświata" languages => '(gb) isbn => '|837359423X|) (book! author => "Agnieszka Jelonek" title => "Koniec świata, umyj okna" isbn => 9788395783814) (book! author => "Wit Szostak" title => "Oberki do końca świata" isbn => 9788367845496) ))) (define (upper s) (string-map (λ (c) (if (>= c 97) (- c 32) c)) s)) (define (country-code->flag cc) (string-map (C + 127397) (upper (str cc)))) (define (aq a b) (cdr* (assoc a b))) (define (maybe-flags book) (if-lets ((l (aq 'languages book))) (fold (λ (a b) (str a (country-code->flag b) " ")) " " l) "")) (define (get-year data) `(p (h2 ,(car data)) ,@(fold (λ (a book) (append a `((details ;; (summary ,(if-lets ((t (aq 'orig-title book))) t (aq 'title book))) (summary ,(aq 'title book) " " ,(maybe-flags book)) (ul ,@(fold (λ (a b) (if-lets ((v (aq b book))) (append a `((li ,(str (aq b keywords) ": " v)))) a)) #n known-keywords) ,@(if-lets ((isbn (aq 'isbn book))) `((li ((a (href . ,(format #f "https://openlibrary.org/search?q=~a&mode=ISBN" isbn))) "lookup on openlibrary.org")) (li ((a (href . ,(format #f "https://isbnsearch.org/isbn/~a" isbn))) "lookup on isbnsearch.org"))) #n)))))) #n (cdr data)))) (define (get-page) `((html (lang . "en")) (head ((meta (charset . "utf-8"))) ((link (rel . "stylesheet") (href . "style.css"))) ((meta (name . "viewport") (content . "width=device-width, initial-scale=1.0")))) (body ((div (id . "main")) (h1 "My reading list") (p "These are some of the books i've read for the past n years. If they're here - I probably enjoyed reading them - so you can also consider this a list of recommendations :)") (p "If you don't understand Polish, first of all hi hello nice seeing you here, but more importantly, look for books with flags next to them, they signalize that the book was written in a language " (b "or") " i know of a translation to a given language.") ,@(map get-year (sort (λ (a b) (> (car a) (car b))) reading-list)) (h6 "generated with " ((a (href . "/reading.scm")) "a simple owl lisp script") " on " ,(date-str (time) 1))) ((script (src . "scripts.js"))) ((script (src . "/ads.js"))) ((script (data-goatcounter . "https://verynice.goatcounter.com/count") (async . "true") (src . "//gc.zgo.at/count.js")))))) (print "") (print (html/encode (get-page)))