put artist on page

This commit is contained in:
Rhiannon Morris 2020-07-14 06:51:46 +02:00
parent fa1076c56e
commit 94bd16504c
1 changed files with 12 additions and 1 deletions

View File

@ -28,7 +28,7 @@ make :: Bool -> Info -> Lazy.Text
make nsfw = toLazyText . make' nsfw
make' :: Bool -> Info -> Builder
make' nsfw (Info {date, title, tags, nsfwTags,
make' nsfw (Info {date, title, artist, tags, nsfwTags,
description, images, links}) = [b|@0
<!DOCTYPE html>
<html lang=en>
@ -37,6 +37,7 @@ make' nsfw (Info {date, title, tags, nsfwTags,
<header>
$titleHeader
$artistTag
<h2 class=date>$formattedDate</date>
$buttonBar
</header>
@ -61,6 +62,8 @@ make' nsfw (Info {date, title, tags, nsfwTags,
titleTag = ifJust title \t -> [b|<title>$*t</title>|]
titleHeader = ifJust title \t -> [b|<h1>$*t</h1>|]
artistTag = ifJust artist makeArtist
formattedDate = formatDate date
buttonBar = makeButtonBar (fromMaybe path0 title) nsfw images
@ -70,6 +73,14 @@ make' nsfw (Info {date, title, tags, nsfwTags,
tagsList = makeTags nsfw tags nsfwTags
linksList = extLinks nsfw links
makeArtist :: Artist -> Builder
makeArtist (Artist {name, url}) =
[b|<h2 class=artist>by $artistLink</h2>|]
where
artistLink = case url of
Just u -> [b|<a href="$*u">$*name</a>|]
Nothing -> [b|$*name|]
makeDesc :: Strict.Text -> Builder
makeDesc desc = [b|@2
<div class=desc>