make title mandatory

This commit is contained in:
Rhiannon Morris 2020-07-19 17:58:19 +02:00
parent b6203a2d4a
commit c10a3ab340
3 changed files with 7 additions and 17 deletions

View file

@ -63,23 +63,17 @@ makeYearItems nsfw year infos = [b|@4
where items = map (uncurry $ makeItem nsfw) infos
makeItem :: Bool -> FilePath -> Info -> Builder
makeItem nsfw file info = [b|@4
makeItem nsfw file info@(Info {title}) = [b|@4
<li $cls>
<figure>
<a href="$@dir">
<img src="$@thumb">
</a>
$title
<figcaption>$*title</figcaption>
</figure>
|]
where
dir = takeDirectory file
thumb = maybe (throw $ NoThumb dir) (\t -> dir </> thumbFile t) $ #thumb info
title = maybe mempty mkTitle $ #title info
mkTitle t = [b|@8
<figcaption>
$*t
</figcaption>
|]
cls | nsfw && #anyNsfw info = [b|class="item nsfw"|]
| otherwise = [b|class=item|]