use FilePath for file paths
This commit is contained in:
parent
d342fc6971
commit
40ffd4f22c
3 changed files with 10 additions and 5 deletions
|
@ -27,7 +27,7 @@ data Info =
|
||||||
nsfwTags :: ![Text],
|
nsfwTags :: ![Text],
|
||||||
description :: !(Maybe Text),
|
description :: !(Maybe Text),
|
||||||
images :: ![Image],
|
images :: ![Image],
|
||||||
thumb :: !(Maybe Text),
|
thumb :: !(Maybe FilePath),
|
||||||
links :: ![Link]
|
links :: ![Link]
|
||||||
}
|
}
|
||||||
deriving (Eq, Show)
|
deriving (Eq, Show)
|
||||||
|
@ -42,7 +42,7 @@ data Artist =
|
||||||
data Image =
|
data Image =
|
||||||
Image {
|
Image {
|
||||||
label :: !Text,
|
label :: !Text,
|
||||||
path :: !Text,
|
path :: !FilePath,
|
||||||
nsfw :: !Bool
|
nsfw :: !Bool
|
||||||
}
|
}
|
||||||
deriving (Eq, Show)
|
deriving (Eq, Show)
|
||||||
|
@ -129,3 +129,6 @@ instance FromYAML Day where
|
||||||
case readMaybe $ Text.unpack str of
|
case readMaybe $ Text.unpack str of
|
||||||
Just d -> pure d
|
Just d -> pure d
|
||||||
Nothing -> fail $ "couldn't parse date " ++ show str
|
Nothing -> fail $ "couldn't parse date " ++ show str
|
||||||
|
|
||||||
|
instance {-# OVERLAPPING #-} FromYAML String where
|
||||||
|
parseYAML y = Text.unpack <$> parseYAML y
|
||||||
|
|
|
@ -43,7 +43,7 @@ make' nsfw (Info {date, title, artist, tags, nsfwTags,
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
<img id=it src="$*path0">
|
<img id=it src="$@path0">
|
||||||
|
|
||||||
$descSection
|
$descSection
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ make' nsfw (Info {date, title, artist, tags, nsfwTags,
|
||||||
|
|
||||||
formattedDate = formatDate date
|
formattedDate = formatDate date
|
||||||
|
|
||||||
buttonBar = makeButtonBar (fromMaybe path0 title) nsfw images
|
buttonBar = makeButtonBar (fromMaybe (Strict.pack path0) title) nsfw images
|
||||||
path0 = #path $ head images
|
path0 = #path $ head images
|
||||||
|
|
||||||
descSection = ifJust description makeDesc
|
descSection = ifJust description makeDesc
|
||||||
|
@ -117,7 +117,7 @@ altButton :: Int -> Image -> Builder
|
||||||
altButton i (Image {label, path, nsfw}) = [b|@6
|
altButton i (Image {label, path, nsfw}) = [b|@6
|
||||||
<li$nsfwClass>
|
<li$nsfwClass>
|
||||||
<input type=radio$checked id="$idLabel" name=variant
|
<input type=radio$checked id="$idLabel" name=variant
|
||||||
autocomplete=off value="$*path">
|
autocomplete=off value="$@path">
|
||||||
<label for="$idLabel">$*label</label>
|
<label for="$idLabel">$*label</label>
|
||||||
|]
|
|]
|
||||||
where
|
where
|
||||||
|
|
|
@ -17,12 +17,14 @@ executable make-pages
|
||||||
DeriveAnyClass,
|
DeriveAnyClass,
|
||||||
DerivingStrategies,
|
DerivingStrategies,
|
||||||
DuplicateRecordFields,
|
DuplicateRecordFields,
|
||||||
|
FlexibleInstances,
|
||||||
LambdaCase,
|
LambdaCase,
|
||||||
NamedFieldPuns,
|
NamedFieldPuns,
|
||||||
OverloadedLabels,
|
OverloadedLabels,
|
||||||
OverloadedStrings,
|
OverloadedStrings,
|
||||||
PatternSynonyms,
|
PatternSynonyms,
|
||||||
QuasiQuotes,
|
QuasiQuotes,
|
||||||
|
TypeSynonymInstances,
|
||||||
ViewPatterns
|
ViewPatterns
|
||||||
build-depends:
|
build-depends:
|
||||||
base >= 4.12.0.0 && < 4.15,
|
base >= 4.12.0.0 && < 4.15,
|
||||||
|
|
Loading…
Reference in a new issue