allow posts to be sorted within a single day
This commit is contained in:
parent
2adee9ee8e
commit
ef9e6f4ad9
1 changed files with 6 additions and 1 deletions
|
@ -36,6 +36,10 @@ import Text.Read (readMaybe)
|
|||
data Info =
|
||||
Info {
|
||||
date :: !Day,
|
||||
-- extra sort key after date
|
||||
-- e.g. multiple things on the same day might have a,b,c in @sortEx@ to
|
||||
-- put them in the right order in the gallery
|
||||
sortEx :: !Text,
|
||||
title :: !Text,
|
||||
artist :: !(Maybe Artist), -- nothing = me, obv
|
||||
nsfwOnly :: !Bool,
|
||||
|
@ -118,7 +122,7 @@ linksFor :: Bool -> Info -> [Link]
|
|||
linksFor nsfw = if nsfw then #links else #sfwLinks
|
||||
|
||||
instance Ord Info where
|
||||
compare = comparing \Info {date, title} -> (date, title)
|
||||
compare = comparing \Info {date, sortEx, title} -> (date, sortEx, title)
|
||||
|
||||
|
||||
newtype NoThumb = NoThumb FilePath
|
||||
|
@ -146,6 +150,7 @@ addSuffix suf path =
|
|||
instance FromYAML Info where
|
||||
parseYAML = YAML.withMap "info" \m ->
|
||||
Info <$> m .: "date"
|
||||
<*> m .:? "sort" .!= ""
|
||||
<*> m .: "title"
|
||||
<*> m .:? "artist"
|
||||
<*> m .:? "nsfw-only" .!= False
|
||||
|
|
Loading…
Reference in a new issue