From 40ffd4f22c829a4ea7303dd4c67d16d83ede99d1 Mon Sep 17 00:00:00 2001 From: Rhiannon Morris Date: Wed, 15 Jul 2020 11:35:32 +0200 Subject: [PATCH] use FilePath for file paths --- make-pages/Info.hs | 7 +++++-- make-pages/SinglePage.hs | 6 +++--- make-pages/make-pages.cabal | 2 ++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/make-pages/Info.hs b/make-pages/Info.hs index ce2c69b..f2a158c 100644 --- a/make-pages/Info.hs +++ b/make-pages/Info.hs @@ -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 diff --git a/make-pages/SinglePage.hs b/make-pages/SinglePage.hs index 3c450b2..a942caf 100644 --- a/make-pages/SinglePage.hs +++ b/make-pages/SinglePage.hs @@ -43,7 +43,7 @@ make' nsfw (Info {date, title, artist, tags, nsfwTags,
- + $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 + autocomplete=off value="$@path"> |] where diff --git a/make-pages/make-pages.cabal b/make-pages/make-pages.cabal index 9a76ed1..90d14ba 100644 --- a/make-pages/make-pages.cabal +++ b/make-pages/make-pages.cabal @@ -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,