put data in subdirs by artist

This commit is contained in:
Rhiannon Morris 2020-07-22 00:13:02 +02:00
parent 488a4cdd08
commit 9e9d2d83b7
4 changed files with 17 additions and 13 deletions

View file

@ -11,6 +11,7 @@ import qualified Data.Text.Lazy as Lazy
import Data.Time (formatTime, defaultTimeLocale)
import qualified Data.Char as Char
import qualified Data.List as List
import System.FilePath (joinPath, splitPath)
-- | e.g. only nsfw images are present for a non-nsfw page
@ -23,12 +24,12 @@ instance Show NoEligibleImages where
" (probably a nsfw-only work without --nsfw set)"
make :: Bool -> Info -> Lazy.Text
make nsfw = toLazyText . make' nsfw
make :: Bool -> FilePath -> Info -> Lazy.Text
make nsfw dir = toLazyText . make' nsfw dir
make' :: Bool -> Info -> Builder
make' nsfw (Info {date, title, artist, tags, nsfwTags,
description, images, links}) = [b|@0
make' :: Bool -> FilePath -> Info -> Builder
make' nsfw dir (Info {date, title, artist, tags, nsfwTags,
description, images, links}) = [b|@0
<!DOCTYPE html>
<html lang=en>
<meta charset=utf-8>
@ -66,7 +67,7 @@ make' nsfw (Info {date, title, artist, tags, nsfwTags,
<footer>
<nav class=back>
<a href=../>back to gallery</a>
<a href=$@undir>back to gallery</a>
</nav>
</footer>
|]
@ -89,6 +90,7 @@ make' nsfw (Info {date, title, artist, tags, nsfwTags,
<span id=cw-text>cw: <b>$*w</b></span>
</figcaption>
|]
undir = joinPath (replicate (length (splitPath dir)) "..")
makeArtist :: Artist -> Builder
makeArtist (Artist {name, url}) =