support for no background at all
This commit is contained in:
parent
57627e2af6
commit
474276e6a1
3 changed files with 29 additions and 7 deletions
|
@ -176,4 +176,4 @@ makeItem nsfw file info@(Info {bg}) = [b|@0
|
||||||
date' = formatShort date
|
date' = formatShort date
|
||||||
year' = #year date
|
year' = #year date
|
||||||
updated' = if #updated info nsfw then [b|true|] else [b|false|]
|
updated' = if #updated info nsfw then [b|true|] else [b|false|]
|
||||||
bgStyle = ifJust bg \col -> [b| style="background: $col"|]
|
bgStyle = case bg of Other col -> [b| style="background: $col"|]; _ -> ""
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
|
{-# OPTIONS_GHC -fdefer-typed-holes #-}
|
||||||
|
|
||||||
{-# OPTIONS_GHC -Wno-orphans #-}
|
{-# OPTIONS_GHC -Wno-orphans #-}
|
||||||
module Info
|
module Info
|
||||||
(Info (..),
|
(Info (..),
|
||||||
tagsFor, descFor, imagesFor, linksFor, updatesFor, compareFor, sortFor,
|
tagsFor, descFor, imagesFor, linksFor, updatesFor, compareFor, sortFor,
|
||||||
Artist (..), Images' (..), Images, Image (..), Desc (..), DescField (..),
|
Artist (..), Images' (..), Images, Image (..), Desc (..), DescField (..),
|
||||||
Link (..), Update (..),
|
Link (..), Update (..), Bg (..),
|
||||||
GalleryInfo (..), GalleryFilters (..), ArtistFilter (..), NsfwFilter (..),
|
GalleryInfo (..), GalleryFilters (..), ArtistFilter (..), NsfwFilter (..),
|
||||||
IndexInfo (..),
|
IndexInfo (..),
|
||||||
readArtistFilter, matchArtist, readNsfwFilter, matchNsfw, matchFilters,
|
readArtistFilter, matchArtist, readNsfwFilter, matchNsfw, matchFilters,
|
||||||
|
@ -57,7 +59,7 @@ data Info =
|
||||||
nsfwTags :: ![Text],
|
nsfwTags :: ![Text],
|
||||||
desc :: !Desc,
|
desc :: !Desc,
|
||||||
nsfwDesc :: !Desc,
|
nsfwDesc :: !Desc,
|
||||||
bg :: !(Maybe Text),
|
bg :: !Bg,
|
||||||
images :: !Images,
|
images :: !Images,
|
||||||
thumb' :: !(Maybe FilePath),
|
thumb' :: !(Maybe FilePath),
|
||||||
links :: ![Link],
|
links :: ![Link],
|
||||||
|
@ -65,6 +67,9 @@ data Info =
|
||||||
}
|
}
|
||||||
deriving (Eq, Show)
|
deriving (Eq, Show)
|
||||||
|
|
||||||
|
data Bg = Default | NoBorder | Other !Text
|
||||||
|
deriving (Eq, Show)
|
||||||
|
|
||||||
data Desc =
|
data Desc =
|
||||||
NoDesc
|
NoDesc
|
||||||
| TextDesc !Text
|
| TextDesc !Text
|
||||||
|
@ -279,12 +284,18 @@ instance FromYAML Info where
|
||||||
<*> m .:? "nsfw-tags" .!= []
|
<*> m .:? "nsfw-tags" .!= []
|
||||||
<*> m .:? "desc" .!= NoDesc
|
<*> m .:? "desc" .!= NoDesc
|
||||||
<*> m .:? "nsfw-desc" .!= NoDesc
|
<*> m .:? "nsfw-desc" .!= NoDesc
|
||||||
<*> m .:? "bg"
|
<*> m .:? "bg" .!= Default
|
||||||
<*> m .: "images"
|
<*> m .: "images"
|
||||||
<*> m .:? "thumb"
|
<*> m .:? "thumb"
|
||||||
<*> m .:? "links" .!= []
|
<*> m .:? "links" .!= []
|
||||||
<*> m .:? "extras" .!= []
|
<*> m .:? "extras" .!= []
|
||||||
|
|
||||||
|
instance FromYAML Bg where
|
||||||
|
parseYAML y =
|
||||||
|
YAML.withNull "default value" (pure Default) y
|
||||||
|
<|> YAML.withStr "css <image> or \"noborder\""
|
||||||
|
(\str -> pure if str == "noborder" then NoBorder else Other str) y
|
||||||
|
|
||||||
instance FromYAML Artist where
|
instance FromYAML Artist where
|
||||||
parseYAML y = justName y <|> withUrl y where
|
parseYAML y = justName y <|> withUrl y where
|
||||||
justName = YAML.withStr "name" \name -> pure $ Artist {name, url = Nothing}
|
justName = YAML.withStr "name" \name -> pure $ Artist {name, url = Nothing}
|
||||||
|
|
|
@ -84,7 +84,18 @@ make' root siteName prefix nsfw _dataDir dir
|
||||||
| otherwise = mempty
|
| otherwise = mempty
|
||||||
let warningT = makeWarning [b|.|]
|
let warningT = makeWarning [b|.|]
|
||||||
|
|
||||||
let bgStyle = ifJust bg \col -> [b|@0
|
let bgStyle = case bg of
|
||||||
|
Default -> ""
|
||||||
|
NoBorder -> [b|@0
|
||||||
|
<style>
|
||||||
|
#mainfig {
|
||||||
|
background: transparent;
|
||||||
|
border: none;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|]
|
||||||
|
Other col -> [b|@0
|
||||||
<style> #mainfig { background: $col; } </style>
|
<style> #mainfig { background: $col; } </style>
|
||||||
|]
|
|]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue