diff --git a/.envrc b/.envrc new file mode 100644 index 00000000..3550a30f --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore index f9fe9dc9..488763cd 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ _cache/ _site/ metadata/ *.bak +.direnv/ +dist-newstyle/ diff --git a/README.md b/README.md index a6ac4af5..00779302 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,11 @@ ### Todo -- [x] Get the little cards working -- [x] Tags -- [ ] Drafts - [ ] Next/Previous page -- [ ] Add png compression as part of the build: -- [ ] Reinstate LQIP - [ ] Mailing list -- [ ] Make nice Favicons by hand? +- [ ] Make a nice Favicon by hand? +- [x] Get the little cards working +- [x] Tags +- [x] Add png compression as part of the build: (we use webp instead) +- [x] Reinstate LQIP +- [x] Drafts diff --git a/about.md b/about.md index 4dd6a636..15e80091 100644 --- a/about.md +++ b/about.md @@ -5,6 +5,7 @@ title: About # About
-A project by [Noon](https://silky.github.io/). Book reviews and other -thoughts on a growing collection of books. Check back regularly for updates! +A project by [Noon](https://www.linkedin.com/in/noonsilk/). Book reviews and +other thoughts on a growing collection of books. Check back regularly for +updates!
diff --git a/book-animation.svg b/book-animation.svg new file mode 100644 index 00000000..7c436b8a --- /dev/null +++ b/book-animation.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/cspell.json b/cspell.json new file mode 100644 index 00000000..eaee68c9 --- /dev/null +++ b/cspell.json @@ -0,0 +1,9 @@ +{ + "version": "0.1", + "language": "en-GB", + "words": [ + "webp", + "goodreads" + ] +} + diff --git a/css/Base.hs b/css/Base.hs index 1fefcc35..209990aa 100644 --- a/css/Base.hs +++ b/css/Base.hs @@ -101,32 +101,44 @@ tags = do textDecoration none allPadding (px 2) - let mkTag t c = a # t ? borderBottom solid (px 2) c + let mkTag t c = a # t ? borderBottom (px 2) solid c - mkTag ".travel" limegreen - mkTag ".personal" pink - mkTag ".quirky" violet - mkTag ".informative" lightskyblue + mkTag ".art" darkmagenta + mkTag ".activism" aquamarine mkTag ".adventurous" sandybrown - mkTag ".short-read" lightslategray - mkTag ".philosophical" gold + mkTag ".architecture" yellowgreen + mkTag ".books" lavender + mkTag ".buddhism" blueviolet + mkTag ".climate" honeydew + mkTag ".compassion" skyblue + mkTag ".democracy" thistle + mkTag ".economics" khaki + mkTag ".empathy" slateblue + mkTag ".ethics" wheat + mkTag ".fantasy" thistle mkTag ".feminism" salmon - mkTag ".racism" chocolate - mkTag ".non-fiction" lightsteelblue - mkTag ".fun" orange mkTag ".fiction" rosybrown + mkTag ".fun" orange mkTag ".history" peru - mkTag ".traumatic" mediumblue - mkTag ".urban-planning" lightseagreen - mkTag ".economics" khaki - mkTag ".buddhism" blueviolet + mkTag ".immigration" Clay.tan + mkTag ".informative" lightskyblue + mkTag ".language" saddlebrown mkTag ".long-read" plum - mkTag ".democracy" thistle - mkTag ".ethics" wheat - mkTag ".compassion" skyblue - mkTag ".empathy" slateblue - mkTag ".activism" aquamarine + mkTag ".music" hotpink + mkTag ".non-fiction" lightsteelblue + mkTag ".parenting" sienna + mkTag ".personal" pink + mkTag ".philanthropy" lightblue + mkTag ".philosophical" gold mkTag ".poetry" orchid + mkTag ".politics" lightsalmon + mkTag ".quirky" violet + mkTag ".racism" chocolate + mkTag ".short-read" lightslategray + mkTag ".technology" coral + mkTag ".traumatic" mediumblue + mkTag ".travel" limegreen + mkTag ".urban-planning" lightseagreen div #".tagCloud" ? do fontSize (em 1.1) @@ -140,7 +152,6 @@ mainContent :: Css mainContent = do div # "#content" ? do backgroundColor oldlace - marginTop (px 10) marginBottom (px 10) allPadding (px 30) display flex @@ -154,9 +165,9 @@ bookList = do flexGrow 1 flexBasis (pct 42) allPadding (pct 2) - borderBottom solid (px 3) black + borderBottom (px 3) solid black - ".books" ? do + section # ".books" ? do display flex flexWrap (FlexWrap "wrap") @@ -165,13 +176,20 @@ bookList = do paddingLeft (px 20) flexDirection column - ".book-image" ? img ? do - width (px 200) + + ".book-image" ? do + display flex + alignItems center + flexDirection column + small ? do + marginTop (px 10) + img ? do + width (px 200) -- Generate the cool shelves. - forM_ [ Text.pack . show $ (2*w + 1) | w <- [0..200]] $ \n -> do - div # ".book" # nthChild n ? do - borderRight solid (px 3) black + -- forM_ [ Text.pack . show $ (2*w + 1) | w <- [0..200]] $ \n -> do + div # ".book" # nthChild "odd" ? do + borderRight (px 3) solid black query Clay.all [Media.maxWidth 1200] $ do -- body ? @@ -181,9 +199,9 @@ bookList = do marginRight (px 20) -- Other side of the shelf - forM_ [ Text.pack . show $ (2*w) | w <- [0..200]] $ \n -> do - div # ".book" # nthChild n ? do - borderLeft solid (px 3) black + -- forM_ [ Text.pack . show $ (2*w) | w <- [0..200]] $ \n -> do + div # ".book" # nthChild "even" ? do + borderLeft (px 3) solid black -- div # ".book" ? do flexBasis (pct 90) @@ -203,8 +221,14 @@ bookList = do -- Smallest query Clay.all [Media.maxWidth 800] $ do + div # "#content" ? do + allMargin (px 5) + allPadding (px 0) + div # ".book" ? do flexDirection column + paddingTop (px 20) + paddingBottom (px 20) ul # "#menu" ? do flexDirection column @@ -236,7 +260,7 @@ links = do fonts :: Css fonts = do body ? do - fontSize (px 14) + fontSize (px 18) let fontSelectors = p <> li <> blockquote <> a <> small @@ -267,7 +291,7 @@ fonts = do mainHeader :: Css mainHeader = do "#header" ? do - marginTop (px 100) + marginTop (px 100) ul # "#menu" ? do margin0 padding0 @@ -321,7 +345,7 @@ reviewPage = do backgroundColor white minWidth (px 200) maxWidth (px 300) - borderBottom solid (px 3) black + borderBottom (px 3) solid black img ? do maxHeight (pct 100) maxWidth (pct 100) @@ -344,7 +368,7 @@ reviewPage = do blockquote ? do paddingLeft (px 10) - borderLeft solid (px 1) silver + borderLeft (px 1) solid silver fontStyle italic div # ".book-info" ? do diff --git a/css/simple.css b/css/simple.css index 96a0c8a6..c3e34157 100644 --- a/css/simple.css +++ b/css/simple.css @@ -3,7 +3,6 @@ div.book-info img { box-shadow: 4.8px 9.6px 9.6px hsl(0deg 0% 0% / 0.35); } - div.newbooks { margin: 20px; display: flex; @@ -18,7 +17,7 @@ div.newbooks img { } div.newbooks div.bb { - border-top: solid 3px silver; + border-top: solid 3px black; box-shadow: 4.8px 9.6px 9.6px hsl(0deg 0% 0% / 0.35); width: 90px; margin: 10px; diff --git a/deploy b/deploy index 96501b36..c96e8834 100755 --- a/deploy +++ b/deploy @@ -1,6 +1,6 @@ #!/bin/sh -set -e +set -ex # Steps: @@ -12,8 +12,8 @@ git stash # - Generate metadata mkdir -p metadata -./make-image-metadata -./git-metadata +./scripts/make-image-metadata +./scripts/git-metadata # - Build the site @@ -39,7 +39,6 @@ rsync -a --filter='P _site/' \ --filter='P .env' \ --filter='P .nojekyll' \ --filter='P metadata' \ - --filter='P CNAME' \ --filter='P spellcheck' \ --delete-excluded \ _site/ . @@ -49,10 +48,10 @@ rsync -a --filter='P _site/' \ git add -A git commit -m "Update." || true -git push -f origin gh-pages +git push --force-with-lease origin gh-pages # - Bring everything back -git checkout master +git checkout main git stash pop diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..17f360db --- /dev/null +++ b/flake.lock @@ -0,0 +1,44 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1677341534, + "narHash": "sha256-zqaJuOTnKzg5AubC4rzzJ/IS5kU5n4U7vxosv1Fv8Ug=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "7076110064c09f0b3942f609f2134c1358ef2e50", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-22.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "stacklock2nix": "stacklock2nix" + } + }, + "stacklock2nix": { + "locked": { + "lastModified": 1676847867, + "narHash": "sha256-AZaNUH0ltgcvS8lhc5vBML7YxkCsDD0y+NpB+2Zd678=", + "owner": "cdepillabout", + "repo": "stacklock2nix", + "rev": "2181b463e0ee05f886613d489e18299327a7cee6", + "type": "github" + }, + "original": { + "owner": "cdepillabout", + "ref": "main", + "repo": "stacklock2nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000..a72a75cd --- /dev/null +++ b/flake.nix @@ -0,0 +1,32 @@ +{ + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11"; + stacklock2nix.url = "github:cdepillabout/stacklock2nix/main"; + }; + + outputs = inputs: + with inputs; let + supportedSystems = [ + "aarch64-darwin" + "aarch64-linux" + "x86_64-darwin" + "x86_64-linux" + ]; + forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f system); + nixpkgsFor = forAllSystems (system: + import nixpkgs { + inherit system; + overlays = [stacklock2nix.overlay self.overlay]; + }); + in { + overlay = import nix/overlay.nix; + + packages = forAllSystems (system: { + site = nixpkgsFor.${system}.site-app; + }); + + defaultPackage = forAllSystems (system: self.packages.${system}.site); + + devShell = forAllSystems (system: nixpkgsFor.${system}.site-dev-shell); + }; +} diff --git a/git-metadata b/git-metadata deleted file mode 100755 index a6d091c6..00000000 --- a/git-metadata +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -set -e - -DATE=`git log HEAD -1 --format=%cd` -COUNT=`git rev-list HEAD --count` -HASH=`git rev-parse HEAD` - -echo "$HASH-$COUNT on $DATE">metadata/gitinfo diff --git a/go b/go index 1c8d864c..0bf0ec20 100755 --- a/go +++ b/go @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env sh set -e @@ -6,4 +6,4 @@ export SHOW_DRAFTS=True # ./scripts/git-metadata -stack run -- clean && stack run -- watch +stack run --nix -- clean && stack run --nix -- watch diff --git a/images/book-animation.svg b/images/book-animation.svg new file mode 100644 index 00000000..1430c77f --- /dev/null +++ b/images/book-animation.svg @@ -0,0 +1,1438 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/images/book-images/a-dutiful-boy-2020.webp b/images/book-images/a-dutiful-boy-2020.webp new file mode 100644 index 00000000..7d852a09 Binary files /dev/null and b/images/book-images/a-dutiful-boy-2020.webp differ diff --git a/images/book-images/against-borders-2022.webp b/images/book-images/against-borders-2022.webp new file mode 100644 index 00000000..0d96ef88 Binary files /dev/null and b/images/book-images/against-borders-2022.webp differ diff --git a/images/book-images/all-we-can-save-2020.webp b/images/book-images/all-we-can-save-2020.webp new file mode 100644 index 00000000..856f6be1 Binary files /dev/null and b/images/book-images/all-we-can-save-2020.webp differ diff --git "a/images/book-images/banzeiro-\303\262k\303\262t\303\263-2023.webp" "b/images/book-images/banzeiro-\303\262k\303\262t\303\263-2023.webp" new file mode 100644 index 00000000..a58337d6 Binary files /dev/null and "b/images/book-images/banzeiro-\303\262k\303\262t\303\263-2023.webp" differ diff --git a/images/book-images/basic-income-2017.webp b/images/book-images/basic-income-2017.webp new file mode 100644 index 00000000..89a8daa5 Binary files /dev/null and b/images/book-images/basic-income-2017.webp differ diff --git a/images/book-images/bullshit-jobs-2018.webp b/images/book-images/bullshit-jobs-2018.webp new file mode 100644 index 00000000..fe204892 Binary files /dev/null and b/images/book-images/bullshit-jobs-2018.webp differ diff --git a/images/book-images/children-of-blood-and-bone-2018.webp b/images/book-images/children-of-blood-and-bone-2018.webp new file mode 100644 index 00000000..4d21d31a Binary files /dev/null and b/images/book-images/children-of-blood-and-bone-2018.webp differ diff --git a/images/book-images/children-of-virtue-and-vengence-2019.webp b/images/book-images/children-of-virtue-and-vengence-2019.webp new file mode 100644 index 00000000..4d503cdb Binary files /dev/null and b/images/book-images/children-of-virtue-and-vengence-2019.webp differ diff --git a/images/book-images/confessions-of-a-booksheller-2019.webp b/images/book-images/confessions-of-a-booksheller-2019.webp new file mode 100644 index 00000000..686d1eca Binary files /dev/null and b/images/book-images/confessions-of-a-booksheller-2019.webp differ diff --git a/images/book-images/empire-of-pain-2021.webp b/images/book-images/empire-of-pain-2021.webp new file mode 100644 index 00000000..7f247692 Binary files /dev/null and b/images/book-images/empire-of-pain-2021.webp differ diff --git a/images/book-images/ending-fossil-fuels-2021.webp b/images/book-images/ending-fossil-fuels-2021.webp new file mode 100644 index 00000000..9dd9095d Binary files /dev/null and b/images/book-images/ending-fossil-fuels-2021.webp differ diff --git a/images/book-images/everyone-in-this-room-will-someday-be-dead-2021.webp b/images/book-images/everyone-in-this-room-will-someday-be-dead-2021.webp new file mode 100644 index 00000000..9db441a3 Binary files /dev/null and b/images/book-images/everyone-in-this-room-will-someday-be-dead-2021.webp differ diff --git a/images/book-images/experiments-in-imagining-otherwise-2021.webp b/images/book-images/experiments-in-imagining-otherwise-2021.webp new file mode 100644 index 00000000..0ace3dd8 Binary files /dev/null and b/images/book-images/experiments-in-imagining-otherwise-2021.webp differ diff --git a/images/book-images/feminism,-interrupted-2020.webp b/images/book-images/feminism,-interrupted-2020.webp new file mode 100644 index 00000000..32c970e0 Binary files /dev/null and b/images/book-images/feminism,-interrupted-2020.webp differ diff --git a/images/book-images/fifty-words-for-snow-2020.webp b/images/book-images/fifty-words-for-snow-2020.webp new file mode 100644 index 00000000..027e9c0d Binary files /dev/null and b/images/book-images/fifty-words-for-snow-2020.webp differ diff --git a/images/book-images/for-the-good-times-2019.webp b/images/book-images/for-the-good-times-2019.webp new file mode 100644 index 00000000..7e31fdcd Binary files /dev/null and b/images/book-images/for-the-good-times-2019.webp differ diff --git a/images/book-images/girlcrush-2022.webp b/images/book-images/girlcrush-2022.webp new file mode 100644 index 00000000..3e8d85dc Binary files /dev/null and b/images/book-images/girlcrush-2022.webp differ diff --git a/images/book-images/giving-back-2022.webp b/images/book-images/giving-back-2022.webp new file mode 100644 index 00000000..01315099 Binary files /dev/null and b/images/book-images/giving-back-2022.webp differ diff --git a/images/book-images/gone-2017.webp b/images/book-images/gone-2017.webp new file mode 100644 index 00000000..7e8a3698 Binary files /dev/null and b/images/book-images/gone-2017.webp differ diff --git a/images/book-images/how-to-blow-up-a-pipeline-2021.webp b/images/book-images/how-to-blow-up-a-pipeline-2021.webp new file mode 100644 index 00000000..d0e1c6c5 Binary files /dev/null and b/images/book-images/how-to-blow-up-a-pipeline-2021.webp differ diff --git a/images/book-images/i-may-be-wrong-2022.webp b/images/book-images/i-may-be-wrong-2022.webp new file mode 100644 index 00000000..8812fe6e Binary files /dev/null and b/images/book-images/i-may-be-wrong-2022.webp differ diff --git a/images/book-images/ice-rivers-2021.webp b/images/book-images/ice-rivers-2021.webp new file mode 100644 index 00000000..3df459de Binary files /dev/null and b/images/book-images/ice-rivers-2021.webp differ diff --git a/images/book-images/index,-a-history-of-the-2022.webp b/images/book-images/index,-a-history-of-the-2022.webp new file mode 100644 index 00000000..18b58530 Binary files /dev/null and b/images/book-images/index,-a-history-of-the-2022.webp differ diff --git a/images/book-images/keats---a-brief-life-in-nine-poems-2021.webp b/images/book-images/keats---a-brief-life-in-nine-poems-2021.webp new file mode 100644 index 00000000..7bf7c53a Binary files /dev/null and b/images/book-images/keats---a-brief-life-in-nine-poems-2021.webp differ diff --git a/images/book-images/my-work-2020.webp b/images/book-images/my-work-2020.webp new file mode 100644 index 00000000..3f3542d3 Binary files /dev/null and b/images/book-images/my-work-2020.webp differ diff --git a/images/book-images/natives-2018.webp b/images/book-images/natives-2018.webp new file mode 100644 index 00000000..13ce7f99 Binary files /dev/null and b/images/book-images/natives-2018.webp differ diff --git a/images/book-images/no-drama-discipline-2014.webp b/images/book-images/no-drama-discipline-2014.webp new file mode 100644 index 00000000..bfa3ab28 Binary files /dev/null and b/images/book-images/no-drama-discipline-2014.webp differ diff --git a/images/book-images/on-dialogue-2004.webp b/images/book-images/on-dialogue-2004.webp new file mode 100644 index 00000000..64452cb1 Binary files /dev/null and b/images/book-images/on-dialogue-2004.webp differ diff --git a/images/book-images/on-time-and-water-2021.webp b/images/book-images/on-time-and-water-2021.webp new file mode 100644 index 00000000..1c981671 Binary files /dev/null and b/images/book-images/on-time-and-water-2021.webp differ diff --git a/images/book-images/once-upon-a-tome-2022.webp b/images/book-images/once-upon-a-tome-2022.webp new file mode 100644 index 00000000..6a80719f Binary files /dev/null and b/images/book-images/once-upon-a-tome-2022.webp differ diff --git a/images/book-images/osebol-2019.webp b/images/book-images/osebol-2019.webp new file mode 100644 index 00000000..b4ccebd8 Binary files /dev/null and b/images/book-images/osebol-2019.webp differ diff --git a/images/book-images/peaces-2021.webp b/images/book-images/peaces-2021.webp new file mode 100644 index 00000000..5279bec9 Binary files /dev/null and b/images/book-images/peaces-2021.webp differ diff --git a/images/book-images/persepolis-2003.webp b/images/book-images/persepolis-2003.webp new file mode 100644 index 00000000..97060574 Binary files /dev/null and b/images/book-images/persepolis-2003.webp differ diff --git a/images/book-images/post-growth-2021.webp b/images/book-images/post-growth-2021.webp new file mode 100644 index 00000000..be56eca2 Binary files /dev/null and b/images/book-images/post-growth-2021.webp differ diff --git a/images/book-images/quantum-listening-2022.webp b/images/book-images/quantum-listening-2022.webp new file mode 100644 index 00000000..da646dc7 Binary files /dev/null and b/images/book-images/quantum-listening-2022.webp differ diff --git a/images/book-images/regenesis-2022.webp b/images/book-images/regenesis-2022.webp new file mode 100644 index 00000000..5e03130d Binary files /dev/null and b/images/book-images/regenesis-2022.webp differ diff --git a/images/book-images/rental-person-who-does-nothing-2023.webp b/images/book-images/rental-person-who-does-nothing-2023.webp new file mode 100644 index 00000000..2e29ff30 Binary files /dev/null and b/images/book-images/rental-person-who-does-nothing-2023.webp differ diff --git a/images/book-images/scattered-all-over-the-earth-2022.webp b/images/book-images/scattered-all-over-the-earth-2022.webp new file mode 100644 index 00000000..cbb1f363 Binary files /dev/null and b/images/book-images/scattered-all-over-the-earth-2022.webp differ diff --git a/images/book-images/sherpa-2022.webp b/images/book-images/sherpa-2022.webp new file mode 100644 index 00000000..44afa7e6 Binary files /dev/null and b/images/book-images/sherpa-2022.webp differ diff --git a/images/book-images/skating-to-antarctica-2005.webp b/images/book-images/skating-to-antarctica-2005.webp new file mode 100644 index 00000000..1e323071 Binary files /dev/null and b/images/book-images/skating-to-antarctica-2005.webp differ diff --git a/images/book-images/small-things-like-these-2021.webp b/images/book-images/small-things-like-these-2021.webp new file mode 100644 index 00000000..c20dc25a Binary files /dev/null and b/images/book-images/small-things-like-these-2021.webp differ diff --git a/images/book-images/speaking-and-being-2022.webp b/images/book-images/speaking-and-being-2022.webp new file mode 100644 index 00000000..29c86fe2 Binary files /dev/null and b/images/book-images/speaking-and-being-2022.webp differ diff --git a/images/book-images/still-born-2022.webp b/images/book-images/still-born-2022.webp new file mode 100644 index 00000000..ccacafe8 Binary files /dev/null and b/images/book-images/still-born-2022.webp differ diff --git a/images/book-images/strong-female-character-2023.webp b/images/book-images/strong-female-character-2023.webp new file mode 100644 index 00000000..ecfdad49 Binary files /dev/null and b/images/book-images/strong-female-character-2023.webp differ diff --git a/images/book-images/terraformed-2020.webp b/images/book-images/terraformed-2020.webp new file mode 100644 index 00000000..c2687196 Binary files /dev/null and b/images/book-images/terraformed-2020.webp differ diff --git a/images/book-images/the-art-of-patience-2021.webp b/images/book-images/the-art-of-patience-2021.webp new file mode 100644 index 00000000..4aad2ca7 Binary files /dev/null and b/images/book-images/the-art-of-patience-2021.webp differ diff --git a/images/book-images/the-cabin-in-the-mountains-2019.webp b/images/book-images/the-cabin-in-the-mountains-2019.webp new file mode 100644 index 00000000..7e73e64b Binary files /dev/null and b/images/book-images/the-cabin-in-the-mountains-2019.webp differ diff --git a/images/book-images/the-cabinet-2021.webp b/images/book-images/the-cabinet-2021.webp new file mode 100644 index 00000000..24dad5d5 Binary files /dev/null and b/images/book-images/the-cabinet-2021.webp differ diff --git a/images/book-images/the-candy-house-2022.webp b/images/book-images/the-candy-house-2022.webp new file mode 100644 index 00000000..3a8d61c7 Binary files /dev/null and b/images/book-images/the-candy-house-2022.webp differ diff --git a/images/book-images/the-cat-who-saved-books-2021.webp b/images/book-images/the-cat-who-saved-books-2021.webp new file mode 100644 index 00000000..8001d349 Binary files /dev/null and b/images/book-images/the-cat-who-saved-books-2021.webp differ diff --git a/images/book-images/the-employees-2020.webp b/images/book-images/the-employees-2020.webp new file mode 100644 index 00000000..92f08bbd Binary files /dev/null and b/images/book-images/the-employees-2020.webp differ diff --git a/images/book-images/the-final-girl-support-group-2021.webp b/images/book-images/the-final-girl-support-group-2021.webp new file mode 100644 index 00000000..8e950de7 Binary files /dev/null and b/images/book-images/the-final-girl-support-group-2021.webp differ diff --git a/images/book-images/the-invisible-actor-1997.webp b/images/book-images/the-invisible-actor-1997.webp new file mode 100644 index 00000000..3ab08c1a Binary files /dev/null and b/images/book-images/the-invisible-actor-1997.webp differ diff --git a/images/book-images/the-joyful-environmentalist-2020.webp b/images/book-images/the-joyful-environmentalist-2020.webp new file mode 100644 index 00000000..9bc4e2a3 Binary files /dev/null and b/images/book-images/the-joyful-environmentalist-2020.webp differ diff --git a/images/book-images/the-last-children-of-tokyo-2018.webp b/images/book-images/the-last-children-of-tokyo-2018.webp new file mode 100644 index 00000000..263ef28f Binary files /dev/null and b/images/book-images/the-last-children-of-tokyo-2018.webp differ diff --git a/images/book-images/the-library-of-ice-2018.webp b/images/book-images/the-library-of-ice-2018.webp new file mode 100644 index 00000000..5e6ba9ba Binary files /dev/null and b/images/book-images/the-library-of-ice-2018.webp differ diff --git a/images/book-images/the-production-of-houses-1985.webp b/images/book-images/the-production-of-houses-1985.webp new file mode 100644 index 00000000..7429131a Binary files /dev/null and b/images/book-images/the-production-of-houses-1985.webp differ diff --git a/images/book-images/the-roads-to-sata-1985.webp b/images/book-images/the-roads-to-sata-1985.webp new file mode 100644 index 00000000..92c075f3 Binary files /dev/null and b/images/book-images/the-roads-to-sata-1985.webp differ diff --git a/images/book-images/the-snakehead-2009.webp b/images/book-images/the-snakehead-2009.webp new file mode 100644 index 00000000..f80c4213 Binary files /dev/null and b/images/book-images/the-snakehead-2009.webp differ diff --git a/images/book-images/the-value-of-a-whale-2022.webp b/images/book-images/the-value-of-a-whale-2022.webp new file mode 100644 index 00000000..89d22e1b Binary files /dev/null and b/images/book-images/the-value-of-a-whale-2022.webp differ diff --git a/images/book-images/the-woman-in-me-2023.webp b/images/book-images/the-woman-in-me-2023.webp new file mode 100644 index 00000000..63e51cb5 Binary files /dev/null and b/images/book-images/the-woman-in-me-2023.webp differ diff --git a/images/book-images/the-world-we-make-2022.webp b/images/book-images/the-world-we-make-2022.webp new file mode 100644 index 00000000..00a444eb Binary files /dev/null and b/images/book-images/the-world-we-make-2022.webp differ diff --git a/images/book-images/there-is-no-planet-b-2019.webp b/images/book-images/there-is-no-planet-b-2019.webp new file mode 100644 index 00000000..1734c6e2 Binary files /dev/null and b/images/book-images/there-is-no-planet-b-2019.webp differ diff --git a/images/book-images/three-women-2019.webp b/images/book-images/three-women-2019.webp new file mode 100644 index 00000000..0213708a Binary files /dev/null and b/images/book-images/three-women-2019.webp differ diff --git a/images/book-images/tokyo-vice-2009.webp b/images/book-images/tokyo-vice-2009.webp new file mode 100644 index 00000000..67c9989a Binary files /dev/null and b/images/book-images/tokyo-vice-2009.webp differ diff --git a/images/book-images/unbound-2021.webp b/images/book-images/unbound-2021.webp new file mode 100644 index 00000000..df739911 Binary files /dev/null and b/images/book-images/unbound-2021.webp differ diff --git a/images/book-images/venice:-city-of-pictures-2023.webp b/images/book-images/venice:-city-of-pictures-2023.webp new file mode 100644 index 00000000..a12b4107 Binary files /dev/null and b/images/book-images/venice:-city-of-pictures-2023.webp differ diff --git a/images/shelf-images/bicycle-race-2018.webp b/images/shelf-images/bicycle-race-2018.webp new file mode 100644 index 00000000..4ed26ef5 Binary files /dev/null and b/images/shelf-images/bicycle-race-2018.webp differ diff --git a/images/shelf-images/children-of-blood-and-bone-2018.webp b/images/shelf-images/children-of-blood-and-bone-2018.webp deleted file mode 100644 index 01cab4b7..00000000 Binary files a/images/shelf-images/children-of-blood-and-bone-2018.webp and /dev/null differ diff --git a/images/shelf-images/ending-fossil-fuels-2021.webp b/images/shelf-images/ending-fossil-fuels-2021.webp deleted file mode 100644 index e9f10c4a..00000000 Binary files a/images/shelf-images/ending-fossil-fuels-2021.webp and /dev/null differ diff --git a/images/shelf-images/himalaya-2020.webp b/images/shelf-images/himalaya-2020.webp new file mode 100644 index 00000000..d5db30a6 Binary files /dev/null and b/images/shelf-images/himalaya-2020.webp differ diff --git a/images/shelf-images/strong-female-character-2023.webp b/images/shelf-images/strong-female-character-2023.webp new file mode 100644 index 00000000..e5d5f5a8 Binary files /dev/null and b/images/shelf-images/strong-female-character-2023.webp differ diff --git a/make-compressed-image b/make-compressed-image deleted file mode 100755 index f20962f8..00000000 --- a/make-compressed-image +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -set -e - -IMAGE=$1 -IMAGE_PATH=/tmp/bb/compressed-images/`dirname $IMAGE` -TARGET_PATH=/tmp/bb/compressed-images/$IMAGE -TARGET_IMAGE=${TARGET_PATH}.png -COLOURS=2 -BLUR=0x70 - -echo "Thinking about image ... \"$IMAGE\"" - -if [ -e $TARGET_IMAGE ] -then - echo "Skipping; compressed image already exists." -else - mkdir -p "$IMAGE_PATH" - # Convert everything to PNG - convert "${IMAGE}[0]" -blur $BLUR +dither -colors $COLOURS "${TARGET_IMAGE}" -fi - -HEIGHT=`identify -format "%h" "${TARGET_IMAGE}"` -WIDTH=`identify -format "%w" "${TARGET_IMAGE}"` -HASH=`base64 "${TARGET_IMAGE}" | tr -d '\n'` -ESCAPED_NAME=`printf "%q" "${IMAGE}"` - -echo "{\"height\": $HEIGHT, \"width\": $WIDTH, \"base64String\": \"$HASH\", \"name\": \"$ESCAPED_NAME\"}">>metadata/images.jsonl diff --git a/make-image-metadata b/make-image-metadata deleted file mode 100755 index b0225f79..00000000 --- a/make-image-metadata +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -set -e - -# Remove metadata, if it's there -if [ -e metadata/images.jsonl ] -then - rm metadata/images.jsonl -fi - -# Make some more. Can't do in parallel. -find images -type f -print0 | xargs -P 1 -0 -I {} \ - ./make-compressed-image "{}" diff --git a/nix/default.nix b/nix/default.nix new file mode 100644 index 00000000..3cd6ce62 --- /dev/null +++ b/nix/default.nix @@ -0,0 +1,29 @@ +{...}: +# Nixpkgs with overlays for stacklock2nix. This is convenient to use with +# `nix repl`: +# +# $ nix repl ./nix +# nix-repl> +# +# Within this nix-repl, you have access to everything defined in ./overlay.nix. +let + flake-lock = builtins.fromJSON (builtins.readFile ../flake.lock); + + nixpkgs-src = builtins.fetchTarball { + url = "https://github.com/NixOS/nixpkgs/archive/${flake-lock.nodes.nixpkgs.locked.rev}.tar.gz"; + sha256 = flake-lock.nodes.nixpkgs.locked.narHash; + }; + + stacklock2nix-src = builtins.fetchTarball { + url = "https://github.com/cdepillabout/stacklock2nix/archive/${flake-lock.nodes.stacklock2nix.locked.rev}.tar.gz"; + sha256 = flake-lock.nodes.stacklock2nix.locked.narHash; + }; + + overlays = [ + (import (stacklock2nix-src + "/nix/overlay.nix")) + (import ./overlay.nix) + ]; + + pkgs = import nixpkgs-src {inherit overlays;}; +in + pkgs diff --git a/nix/overlay.nix b/nix/overlay.nix new file mode 100644 index 00000000..318ab37e --- /dev/null +++ b/nix/overlay.nix @@ -0,0 +1,48 @@ +final: prev: { + site-stacklock = final.stacklock2nix { + stackYaml = ../stack.yaml; + }; + + site-pkg-set = final.haskell.packages.ghc925.override (oldAttrs: { + overrides = final.lib.composeManyExtensions [ + (oldAttrs.overrides or (_: _: {})) + + final.site-stacklock.stackYamlResolverOverlay + final.site-stacklock.stackYamlExtraDepsOverlay + final.site-stacklock.stackYamlLocalPkgsOverlay + final.site-stacklock.suggestedOverlay + + (hfinal: hprev: rec { + # Missing dep. + digest = final.haskell.lib.addBuildDepend hprev.digest final.pkgs.zlib; + # Some tests don't work + unliftio-core = final.haskell.lib.dontCheck hprev.unliftio-core; + pandoc = final.haskell.lib.dontCheck hprev.pandoc; + hspec-contrib = final.haskell.lib.dontCheck hprev.hspec-contrib; + }) + ]; + + all-cabal-hashes = final.fetchurl { + name = "all-cabal-hashes"; + url = + let commit = "4d0865132ec79c472a3e10d385324e7e96467eab"; + in "https://github.com/commercialhaskell/all-cabal-hashes/archive/${commit}.tar.gz"; + sha256 = "sha256-SB/GkRzvQrv3d2Yrkjb+mMDXNLU69/8mxfRp6ruEpgQ="; + }; + }); + + site-app = final.site-pkg-set.between-books-site; + + # Actually, the dev-shell for the entire project. + site-dev-shell = final.site-pkg-set.shellFor rec { + packages = haskPkgs: final.site-stacklock.localPkgsSelector haskPkgs; + nativeBuildInputs = [ + final.cabal-install + final.stack + # Random things that could/should be cleaned up. + final.rsync + final.imagemagick + ]; + }; +} + diff --git a/nix/stack-shell.nix b/nix/stack-shell.nix new file mode 100644 index 00000000..e532d78c --- /dev/null +++ b/nix/stack-shell.nix @@ -0,0 +1,16 @@ +{ + # This is the ghc that stack passes in, but we just ignore it. + ghc, + ... +}: +with (import ./. {}); + haskell.lib.compose.buildStackProject { + name = "site-stack-shell"; + ghc = site-pkg-set.ghc; + nativeBuildInputs = [ + bzip2 + zlib + zlib.dev + ]; + } + diff --git a/scripts/git-metadata b/scripts/git-metadata index a6d091c6..b8750eec 100755 --- a/scripts/git-metadata +++ b/scripts/git-metadata @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e diff --git a/scripts/make-compressed-image b/scripts/make-compressed-image index 0d1a4b21..22f6a7db 100755 --- a/scripts/make-compressed-image +++ b/scripts/make-compressed-image @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e diff --git a/scripts/make-image-metadata b/scripts/make-image-metadata index b0225f79..6d9bfa2a 100755 --- a/scripts/make-image-metadata +++ b/scripts/make-image-metadata @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env sh set -e @@ -10,4 +10,4 @@ fi # Make some more. Can't do in parallel. find images -type f -print0 | xargs -P 1 -0 -I {} \ - ./make-compressed-image "{}" + ./scripts/make-compressed-image "{}" diff --git a/shelf/bicycle-race-2018.md b/shelf/bicycle-race-2018.md new file mode 100644 index 00000000..e091e712 --- /dev/null +++ b/shelf/bicycle-race-2018.md @@ -0,0 +1,19 @@ +--- +imageUrl: /images/shelf-images/bicycle-race-2018.webp +id: bicycle-race-2018 +title: "Bicycle/Race: Transportation, Culture, & Resistance" +simpleTitle: "Bicycle/Race" +authors: + - Adonia E. Lugo +yearPublished: 2018 +publisher: "Microcosm Publishing" +goodreadsLink: https://www.goodreads.com/book/show/40210583-bicycle-race +bookshopLink: https://uk.bookshop.org/books/bicycle-race-transportation-culture-resistance/9781621067641 +pages: 191 +tags: + - activism + - racism +date: 2022-01-30 +issueCreatedAt: 2021-11-28T13:15:45Z +--- + diff --git a/shelf/children-of-blood-and-bone-2018.md b/shelf/children-of-blood-and-bone-2018.md deleted file mode 100644 index d5ce2f32..00000000 --- a/shelf/children-of-blood-and-bone-2018.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -imageUrl: /images/shelf-images/children-of-blood-and-bone-2018.webp -id: children-of-blood-and-bone-2018 -title: "Children of Blood and Bone" -simpleTitle: "Children of Blood and Bone" -authors: - - Tomi Adeyemi -yearPublished: 2018 -publisher: "Henry Holt Company" -goodreadsLink: https://www.goodreads.com/book/show/34728667-children-of-blood-and-bone -bookshopLink: https://uk.bookshop.org/books/children-of-blood-and-bone/9781509871353 -pages: 544 -tags: - - feminism - - fiction -date: 2021-11-28 -issueCreatedAt: 2021-11-21T18:25:17Z ---- - diff --git a/shelf/doughnut-economics-2017.md b/shelf/doughnut-economics-2017.md index ee77acdc..9e484f66 100644 --- a/shelf/doughnut-economics-2017.md +++ b/shelf/doughnut-economics-2017.md @@ -11,7 +11,7 @@ goodreadsLink: https://www.goodreads.com/book/show/29214420-doughnut-economics bookshopLink: https://uk.bookshop.org/books/doughnut-economics-seven-ways-to-think-like-a-21st-century-economist/9781847941398 pages: 384 tags: -date: 2021-11-28 +date: 2022-01-30 issueCreatedAt: 2021-11-23T16:09:58Z --- diff --git a/shelf/ending-fossil-fuels-2021.md b/shelf/ending-fossil-fuels-2021.md deleted file mode 100644 index 9710c7fd..00000000 --- a/shelf/ending-fossil-fuels-2021.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -imageUrl: /images/shelf-images/ending-fossil-fuels-2021.webp -id: ending-fossil-fuels-2021 -title: "Ending Fossil Fuels: Why Net Zero is Not Enough" -simpleTitle: "Ending Fossil Fuels" -authors: - - Holly Jean Buck -yearPublished: 2021 -publisher: "Verso" -goodreadsLink: https://www.goodreads.com/book/show/59495922-ending-fossil-fuels -bookshopLink: https://uk.bookshop.org/books/ending-fossil-fuels-why-net-zero-is-not-enough/9781839762345 -pages: 208 -tags: - - economics -date: 2021-11-28 -issueCreatedAt: 2021-11-23T13:46:33Z ---- - diff --git a/shelf/entangled-life-2020.md b/shelf/entangled-life-2020.md index 5e57fdcf..4ea2d29a 100644 --- a/shelf/entangled-life-2020.md +++ b/shelf/entangled-life-2020.md @@ -11,7 +11,7 @@ goodreadsLink: https://www.goodreads.com/book/show/52668915-entangled-life bookshopLink: https://uk.bookshop.org/books/entangled-life-the-phenomenal-sunday-times-bestseller-exploring-how-fungi-make-our-worlds-change-our-minds-and-shape-our-futur/9781784708276 pages: 366 tags: -date: 2021-11-28 +date: 2022-01-30 issueCreatedAt: 2021-11-24T12:01:05Z --- diff --git a/shelf/essays-in-idleness-1998.md b/shelf/essays-in-idleness-1998.md index 8d2018cf..4702930c 100644 --- a/shelf/essays-in-idleness-1998.md +++ b/shelf/essays-in-idleness-1998.md @@ -13,7 +13,7 @@ goodreadsLink: https://www.goodreads.com/book/show/321596.Essays_in_Idleness? bookshopLink: https://uk.bookshop.org/books/essays-in-idleness-and-hojoki/9780141192109 pages: 235 tags: -date: 2021-11-28 +date: 2022-01-30 issueCreatedAt: 2021-11-23T16:36:57Z --- diff --git a/shelf/himalaya-2020.md b/shelf/himalaya-2020.md new file mode 100644 index 00000000..d7dcf665 --- /dev/null +++ b/shelf/himalaya-2020.md @@ -0,0 +1,17 @@ +--- +imageUrl: /images/shelf-images/himalaya-2020.webp +id: himalaya-2020 +title: "Himalaya: A Human History" +simpleTitle: "Himalaya" +authors: + - Ed Douglas +yearPublished: 2020 +publisher: "Bodley Head" +goodreadsLink: https://www.goodreads.com/book/show/49098218-himalaya +bookshopLink: https://uk.bookshop.org/books/himalaya-a-human-history-9781847924131/9781784704483 +pages: 592 +tags: +date: 2022-01-30 +issueCreatedAt: 2021-11-28T11:52:20Z +--- + diff --git a/shelf/how-to-kill-a-city-2017.md b/shelf/how-to-kill-a-city-2017.md index ffc7f7e9..5fa30d17 100644 --- a/shelf/how-to-kill-a-city-2017.md +++ b/shelf/how-to-kill-a-city-2017.md @@ -3,15 +3,16 @@ imageUrl: /images/shelf-images/how-to-kill-a-city-2017.webp id: how-to-kill-a-city-2017 title: "How to Kill a City: Gentrification, Inequality, and the Fight for the Neighborhood" simpleTitle: "How to Kill a City" -authors: - - Peter Moskowitz +authors: + - Peter Moskowitz + - P.E. Moskowitz yearPublished: 2017 publisher: "Bold Type Books" goodreadsLink: https://www.goodreads.com/book/show/30652247-how-to-kill-a-city bookshopLink: https://uk.bookshop.org/books/how-to-kill-a-city-gentrification-inequality-and-the-fight-for-the-neighborhood/9781568589039 pages: 272 -tags: -date: 2021-11-28 +tags: +date: 2022-01-30 issueCreatedAt: 2021-11-24T12:30:21Z --- diff --git a/shelf/meeting-the-universe-halfway-2007.md b/shelf/meeting-the-universe-halfway-2007.md index 6173e907..e6a22bd8 100644 --- a/shelf/meeting-the-universe-halfway-2007.md +++ b/shelf/meeting-the-universe-halfway-2007.md @@ -13,7 +13,7 @@ pages: 524 tags: - feminism - physics -date: 2021-11-28 +date: 2022-01-30 issueCreatedAt: 2021-11-22T09:59:39Z --- diff --git a/shelf/notes-from-deep-time-2021.md b/shelf/notes-from-deep-time-2021.md index 3d2d0060..3a0678ed 100644 --- a/shelf/notes-from-deep-time-2021.md +++ b/shelf/notes-from-deep-time-2021.md @@ -11,7 +11,7 @@ goodreadsLink: https://www.goodreads.com/book/show/50353808-notes-from-deep-time bookshopLink: https://uk.bookshop.org/books/notes-from-deep-time-a-journey-through-our-past-and-future-worlds/9781788161633 pages: 320 tags: -date: 2021-11-28 +date: 2022-01-30 issueCreatedAt: 2021-11-24T13:51:12Z --- diff --git a/shelf/the-poetic-edda-1999.md b/shelf/the-poetic-edda-1999.md index b4d5cb09..796c2b3e 100644 --- a/shelf/the-poetic-edda-1999.md +++ b/shelf/the-poetic-edda-1999.md @@ -13,7 +13,7 @@ bookshopLink: https://uk.bookshop.org/books/the-poetic-edda-9780199675340/978019 pages: 323 tags: - poetry -date: 2021-11-28 +date: 2022-01-30 issueCreatedAt: 2021-11-23T13:42:34Z --- diff --git a/site.cabal b/site.cabal index 4b4edbf4..83a4f620 100644 --- a/site.cabal +++ b/site.cabal @@ -5,7 +5,7 @@ cabal-version: >= 1.10 executable site main-is: site.hs - build-depends: base == 4.* + build-depends: base , MissingH , aeson , blaze-html diff --git a/site.hs b/site.hs index 2d45fd6e..d0560524 100644 --- a/site.hs +++ b/site.hs @@ -4,28 +4,27 @@ {-# language TupleSections #-} {-# language TypeApplications #-} -import Data.Time.Clock (UTCTime (..)) -import Data.Time.Format (parseTimeM) -import Data.List (sortBy) -import Data.Ord (comparing) -import Data.Time.Locale.Compat (TimeLocale, defaultTimeLocale) -import Control.Monad (liftM) +import Control.Monad (liftM) import Data.Aeson import Data.List -import Data.String.Utils (strip) -import Data.Maybe (fromJust, isJust, fromMaybe, maybe) -import Data.String.Conv (toS) +import Data.List.Split (splitOn) +import Data.Maybe (fromJust, isJust, fromMaybe) +import Data.Ord (comparing) +import Data.String.Conv (toS) +import Data.String.Utils (strip) +import Data.Time.Clock (UTCTime (..)) +import Data.Time.Format (parseTimeM) +import Data.Time.Locale.Compat (TimeLocale, defaultTimeLocale) import GHC.Generics import Hakyll -import Hakyll.Core.UnixFilter (unixFilter) -import System.Environment (lookupEnv) +import System.Environment (lookupEnv) import System.FilePath -import Text.HTML.TagSoup (Tag (..)) -import qualified Text.Blaze.Html5 as H -import qualified Text.Blaze.Html5.Attributes as A import Text.Blaze.Html (toHtml, toValue, (!)) import Text.Blaze.Html.Renderer.String (renderHtml) -import qualified Data.Map as M +import Text.HTML.TagSoup ( Tag (..)) +import qualified Data.Map as M +import qualified Text.Blaze.Html5 as H +import qualified Text.Blaze.Html5.Attributes as A config :: Configuration @@ -76,10 +75,11 @@ main = do match "css/*.hs" $ do -- See: https://jaspervdj.be/hakyll/tutorials/using-clay-with-hakyll.html - route $ setExtension "css" + route $ setExtension "css" + + let cssStr = getResourceString >>= withItemBody (unixFilter "runghc" []) - let cssStr = getResourceString >>= withItemBody (unixFilter "stack" ["runghc"]) - compile $ fmap compressCss <$> cssStr + compile $ fmap compressCss <$> cssStr let draftCheck = if showDrafts then @@ -113,24 +113,26 @@ main = do compile $ getResourceBody >>= renderPandoc + >>= saveSnapshot "content" >>= loadAndApplyTemplate "templates/review.html" ctx >>= loadAndApplyTemplate "templates/default.html" ctx - >>= applyAsTemplate ctx >>= lqipImages imageMetaData >>= relativizeUrls tagsRules tags $ \tag pattern -> do route idRoute compile $ do - books <- recentFirst =<< loadAll pattern - tagCloud <- renderTagCloudWith makeLink (intercalate " ") 90 180 tags - shelfUpdates <- byIssueCreationTime =<< loadAll "shelf/*.md" - - let tagCtx = constField "tag" tag - <> listField "books" bookContext (return books) - <> listField "shelfItems" bookContext (return shelfUpdates) - <> constField "tagCloud" tagCloud - <> constField "commit" commitDetails + books <- recentFirst =<< loadAll pattern + tagCloud <- renderTagCloudWith makeLink (intercalate " ") 90 180 tags + -- TODO: Load the shelf updates with the specific tags. + -- shelfUpdates <- byIssueCreationTime =<< loadAll pattern + let shelfUpdates = [] + + let tagCtx = constField "tag" tag + <> listField "books" bookContext (return books) + <> listField "shelfItems" bookContext (return shelfUpdates) + <> constField "tagCloud" tagCloud + <> constField "commit" commitDetails <> bookContext makeItem "" @@ -172,6 +174,28 @@ main = do >>= lqipImages imageMetaData >>= relativizeUrls + create ["atom.xml"] $ do + route idRoute + compile $ do + let feedCtx = bookContext `mappend` (field "description" f) + f i = do + let identifier = itemIdentifier i + metadata <- getMetadata identifier + pure $ maybe (error "No summary") id $ lookupString "summary" metadata + + posts <- fmap (take 10) . recentFirst =<< loadAllSnapshots "updates/**.md" "content" + renderAtom feedConf feedCtx posts + + +feedConf :: FeedConfiguration +feedConf = FeedConfiguration + { feedTitle = "Between Books" + , feedDescription = "The Interdependent Bookshop!" + , feedAuthorName = "Noon van der Silk" + , feedAuthorEmail = "noonsilk+-noonsilk@gmail.com" + , feedRoot = "https://betweenbooks.com.au" + } + byIssueCreationTime :: (MonadMetadata m) => [Item a] -> m [Item a] byIssueCreationTime = liftM reverse . chronological' @@ -220,19 +244,44 @@ makeLink minSize maxSize tag url count min' max' = bookContext :: Context String bookContext = asList "authors" - <> asList "tags" + <> asSortedList "tags" <> bbContext + <> mkAffiliate "affiliateLink" where - -- HACK: Build a list from a list. - asList fieldName + -- Make the affiliate link from the bookshop link. + mkAffiliate fieldName + = field fieldName (\i -> do + let identifier = itemIdentifier i + metadata <- getMetadata identifier + let link = maybe "" affiliateLink $ lookupString "bookshopLink" metadata + return link + ) + + asList = asSortedList' id + asSortedList = asSortedList' sort + asSortedList' sortFunc fieldName = listFieldWith fieldName bbContext (\i -> do let identifier = itemIdentifier i metadata <- getMetadata identifier let metas = maybe [] id $ lookupStringList fieldName metadata - return $ map (\x -> Item (fromFilePath x) x) (sort metas) + return $ map (\x -> Item (fromFilePath x) x) (sortFunc metas) ) +-- | Bookshop.org affiliate code. +affiliateCode :: String +affiliateCode = "7342" + + +affiliateLink :: String -> String +affiliateLink s = + let j = splitOn "?ean=" s + in case j of + [_, ean] -> "https://uk.bookshop.org/a/" ++ affiliateCode ++ "/" ++ ean + _ -> let items = splitOn "/" s + in "https://uk.bookshop.org/a/" ++ affiliateCode ++ "/" ++ last items + + bbContext :: Context String bbContext = constField "rootUrl" "https://betweenbooks.com.au" @@ -260,6 +309,7 @@ instance FromJSON ImageData type ImageMetaDataMap = M.Map String ImageData + computeImageMetaData :: IO (ImageMetaDataMap) computeImageMetaData = do items <- lines <$> readFile "./metadata/images.jsonl" diff --git a/spellcheck b/spellcheck deleted file mode 100755 index 1551a58a..00000000 --- a/spellcheck +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -for i in reviews/**/*.md; -do - echo "Checking $i ..." - pandoc --lua-filter \ - ~/dev/ext/pandoc-lua-filters/spellcheck/spellcheck.lua \ - $i - echo - echo -done diff --git a/stack.yaml b/stack.yaml index ee361c15..5fafd70a 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,5 +1,9 @@ -resolver: lts-12.26 +resolver: lts-20.11 packages: - . -extra-deps: -- hakyll-sass-0.2.4@sha256:4d2fbd8b63f5ef15483fc6dda09e10eefd63b4f873ad38dec2a3607eb504a8ba,939 +nix: + shell-file: "./nix/stack-shell.nix" +extra-deps: + - github: sebastiaanvisser/clay + commit: f162121b4dcccdab01dbedf4b4144f2d8d13a2a6 + - hakyll-sass-0.2.4@sha256:4d2fbd8b63f5ef15483fc6dda09e10eefd63b4f873ad38dec2a3607eb504a8ba,939 diff --git a/stack.yaml.lock b/stack.yaml.lock index 14fad6d3..e3fbadb5 100644 --- a/stack.yaml.lock +++ b/stack.yaml.lock @@ -4,16 +4,27 @@ # https://docs.haskellstack.org/en/stable/lock_files packages: +- completed: + name: clay + pantry-tree: + sha256: 429336c1b31927297aeb02272eb7b7dbbb4896940f9231cfdaae33c32599fded + size: 4153 + sha256: 3f9d8b97a593c2a0966b4dea3c2322c78f4d4fab6517d6fde8a52923faf0c411 + size: 51023 + url: https://github.com/sebastiaanvisser/clay/archive/f162121b4dcccdab01dbedf4b4144f2d8d13a2a6.tar.gz + version: 0.14.0 + original: + url: https://github.com/sebastiaanvisser/clay/archive/f162121b4dcccdab01dbedf4b4144f2d8d13a2a6.tar.gz - completed: hackage: hakyll-sass-0.2.4@sha256:4d2fbd8b63f5ef15483fc6dda09e10eefd63b4f873ad38dec2a3607eb504a8ba,939 pantry-tree: - size: 217 sha256: c03e74e71d010f009b8d972efc31fbd6dd25183e6d9afbec55f4b7f0d4a74b47 + size: 217 original: hackage: hakyll-sass-0.2.4@sha256:4d2fbd8b63f5ef15483fc6dda09e10eefd63b4f873ad38dec2a3607eb504a8ba,939 snapshots: - completed: - size: 509471 - url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/12/26.yaml - sha256: 95f014df58d0679b1c4a2b7bf2b652b61da8d30de5f571abb0d59015ef678646 - original: lts-12.26 + sha256: adbc602422dde10cc330175da7de8609e70afc41449a7e2d6e8b1827aa0e5008 + size: 649342 + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/20/11.yaml + original: lts-20.11 diff --git a/templates/book-list.html b/templates/book-list.html index 63586296..b6c014bb 100644 --- a/templates/book-list.html +++ b/templates/book-list.html @@ -8,6 +8,7 @@
$simpleTitle$ - Cover + Find on Bookshop.org
@@ -36,20 +37,5 @@
$endfor$ -
-

On the shelf — Newly obtained but not yet reviewed ...

- -
- $for(shelfItems)$ -
- $simpleTitle$ -

$simpleTitle$

- $for(authors)$ - $body$ - $endfor$ - $yearPublished$ -
- $endfor$ -
diff --git a/templates/default.html b/templates/default.html index 9b18b956..4f6aeb34 100644 --- a/templates/default.html +++ b/templates/default.html @@ -8,7 +8,7 @@ - + @@ -30,12 +30,14 @@ $endif$ -