replace OverloadedLabels with OverloadedRecordDot
This commit is contained in:
parent
cd5801dd7d
commit
28520eb443
8 changed files with 126 additions and 138 deletions
|
@ -4,7 +4,6 @@ module SinglePage (make) where
|
|||
import Date
|
||||
import Info
|
||||
import BuilderQQ
|
||||
import Records ()
|
||||
import qualified NsfwWarning
|
||||
|
||||
import Control.Exception
|
||||
|
@ -17,6 +16,7 @@ import System.FilePath (joinPath, splitPath)
|
|||
import qualified Data.HashSet as Set
|
||||
import Data.Traversable
|
||||
import Data.Semigroup
|
||||
import Data.List.NonEmpty (toList)
|
||||
|
||||
|
||||
-- | e.g. only nsfw images are present for a non-nsfw page
|
||||
|
@ -51,7 +51,7 @@ make' root siteName prefix nsfw _dataDir dir
|
|||
|
||||
let buttonBar = makeButtonBar title $ addIds images
|
||||
|
||||
let image0 :| otherImages = #all images
|
||||
let image0 :| otherImages = allImages images
|
||||
let Image {path = path0, download = download0'} = image0
|
||||
|
||||
let download0 = fromMaybe (bigFile path0) download0'
|
||||
|
@ -79,9 +79,9 @@ make' root siteName prefix nsfw _dataDir dir
|
|||
if you can let me know i'd appreciate it
|
||||
|]
|
||||
let warning'
|
||||
| Just w <- #warning image0 = makeWarning w
|
||||
| #nsfw image0 = makeWarning defWarning
|
||||
| otherwise = mempty
|
||||
| Just w <- image0.warning = makeWarning w
|
||||
| image0.nsfw = makeWarning defWarning
|
||||
| otherwise = mempty
|
||||
let warningT = makeWarning [b|.|]
|
||||
|
||||
let bgStyle = case bg of
|
||||
|
@ -103,7 +103,7 @@ make' root siteName prefix nsfw _dataDir dir
|
|||
let desc = case artist of
|
||||
Just (Artist {name}) -> [b|by $name|]
|
||||
Nothing -> "by niss"
|
||||
let thumb = getThumb "" info
|
||||
let thumbnail = getThumb "" info
|
||||
|
||||
let updateDate = ifJust (last' updates) \(d, _) ->
|
||||
let updated = formatLong d in
|
||||
|
@ -114,12 +114,12 @@ make' root siteName prefix nsfw _dataDir dir
|
|||
let nsfwDialog = NsfwWarning.dialog nsfw'
|
||||
|
||||
let imageMeta =
|
||||
if #sfw image0 && isNothing (#warning image0) then [b|@0
|
||||
if image0.sfw && isNothing image0.warning then [b|@0
|
||||
<meta property=og:image content="$url/$path0'">
|
||||
<meta name=twitter:card content=summary_large_image>
|
||||
<meta name=twitter:image content="$url/$path0'">
|
||||
|] else [b|@0
|
||||
<meta property=og:image content="$url/$thumb">
|
||||
<meta property=og:image content="$url/$thumbnail">
|
||||
<meta name=twitter:card content=summary>
|
||||
|]
|
||||
|
||||
|
@ -249,7 +249,7 @@ addIds = snd . mapAccumL makeId Set.empty where
|
|||
makeId used img = (Set.insert newId used, (img, newId)) where
|
||||
newId = headI $ filterI (\i -> not $ i `Set.member` used) ids
|
||||
ids = fmap (\i -> toStrictText [b|$label$i|]) suffixes
|
||||
label = escId $ #label img
|
||||
label = escId $ img.label
|
||||
|
||||
|
||||
pattern One :: a -> NonEmpty a
|
||||
|
@ -287,7 +287,7 @@ makeButtonBar title images =
|
|||
</ul> |]
|
||||
where elems = fmap (uncurry altButton) imgs
|
||||
skipAll =
|
||||
if any (isJust . #warning . fst) images then
|
||||
if any (isJust . (.warning) . fst) images then
|
||||
[b|@0
|
||||
<div class=buttonbar id=skipAllDiv>
|
||||
<input type=checkbox name=skipAll id=skipAll>
|
||||
|
@ -351,7 +351,7 @@ extLink (Link {title, url}) = [b|@8
|
|||
</a>
|
||||
|]
|
||||
|
||||
makeUpdates :: [(Date, [Update])] -> Builder
|
||||
makeUpdates :: [(Date, NonEmpty Update)] -> Builder
|
||||
makeUpdates ups =
|
||||
if all (null . snd) ups then "" else [b|@4
|
||||
<section id=updates class=info-section>
|
||||
|
@ -361,13 +361,12 @@ makeUpdates ups =
|
|||
</dl>
|
||||
</section>
|
||||
|]
|
||||
where updateList = map (uncurry makeUpdate) ups
|
||||
where updateList = fmap (uncurry makeUpdate) ups
|
||||
|
||||
makeUpdate :: Date -> [Update] -> Builder
|
||||
makeUpdate _ [] = ""
|
||||
makeUpdate :: Date -> NonEmpty Update -> Builder
|
||||
makeUpdate date ups = [b|@8
|
||||
<dt>$date'
|
||||
<dd>$desc
|
||||
|] where
|
||||
date' = formatSlash date
|
||||
desc = mconcat $ map fromText $ intersperse "; " $ map #desc ups
|
||||
desc = mconcat $ map fromText $ intersperse "; " $ toList $ fmap (.desc) ups
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue