use FilePath for file paths

This commit is contained in:
Rhiannon Morris 2020-07-15 11:35:32 +02:00
parent d342fc6971
commit 40ffd4f22c
3 changed files with 10 additions and 5 deletions

View file

@ -27,7 +27,7 @@ data Info =
nsfwTags :: ![Text],
description :: !(Maybe Text),
images :: ![Image],
thumb :: !(Maybe Text),
thumb :: !(Maybe FilePath),
links :: ![Link]
}
deriving (Eq, Show)
@ -42,7 +42,7 @@ data Artist =
data Image =
Image {
label :: !Text,
path :: !Text,
path :: !FilePath,
nsfw :: !Bool
}
deriving (Eq, Show)
@ -129,3 +129,6 @@ instance FromYAML Day where
case readMaybe $ Text.unpack str of
Just d -> pure d
Nothing -> fail $ "couldn't parse date " ++ show str
instance {-# OVERLAPPING #-} FromYAML String where
parseYAML y = Text.unpack <$> parseYAML y

View file

@ -43,7 +43,7 @@ make' nsfw (Info {date, title, artist, tags, nsfwTags,
</header>
<main>
<img id=it src="$*path0">
<img id=it src="$@path0">
$descSection
@ -66,7 +66,7 @@ make' nsfw (Info {date, title, artist, tags, nsfwTags,
formattedDate = formatDate date
buttonBar = makeButtonBar (fromMaybe path0 title) nsfw images
buttonBar = makeButtonBar (fromMaybe (Strict.pack path0) title) nsfw images
path0 = #path $ head images
descSection = ifJust description makeDesc
@ -117,7 +117,7 @@ altButton :: Int -> Image -> Builder
altButton i (Image {label, path, nsfw}) = [b|@6
<li$nsfwClass>
<input type=radio$checked id="$idLabel" name=variant
autocomplete=off value="$*path">
autocomplete=off value="$@path">
<label for="$idLabel">$*label</label>
|]
where

View file

@ -17,12 +17,14 @@ executable make-pages
DeriveAnyClass,
DerivingStrategies,
DuplicateRecordFields,
FlexibleInstances,
LambdaCase,
NamedFieldPuns,
OverloadedLabels,
OverloadedStrings,
PatternSynonyms,
QuasiQuotes,
TypeSynonymInstances,
ViewPatterns
build-depends:
base >= 4.12.0.0 && < 4.15,