bibliogram/src/site/pug/includes/post.pug

55 lines
2.2 KiB
Plaintext

include ./display_structured
mixin post(post, headerWithNavigation)
.post-page-divider(class={
"caption-on-right": settings.caption_side === "right"
})
- let willDisplayAlt = settings.display_alt && post.children.some(p => p.data.accessibility_caption)
- let willDisplayAltInDescription = willDisplayAlt && post.children.length === 1
- let willDisplayAltInGallery = willDisplayAlt && post.children.length !== 1
section.description-section
.user-header
header.user-header-inner
img(src=post.ownerPfpCacheP width=150 height=150 alt="").pfp
a.name(href=`/u/${post.getBasicOwner().username}`)
if post.data.owner.full_name
= `${post.data.owner.full_name} (@${post.getBasicOwner().username})`
else
= `@${post.getBasicOwner().username}`
if headerWithNavigation
button(data-previous).navigate-posts
img(src=getStaticURL("html", "/static/img/arrow-circled.svg") alt="Previous post.").icon.previous
button(data-next).navigate-posts
img(src=getStaticURL("html", "/static/img/arrow-circled.svg") alt="Next post.").icon
div.relative-box
div.scrolling-box
div
if post.getCaption()
p.structured-text.description
if settings.remove_trailing_hashtags
+display_structured(post.getStructuredCaptionWithoutTrailingHashtags())
else
+display_structured(post.getStructuredCaption())
footer
if willDisplayAltInDescription
- let caption = post.children[0].data.accessibility_caption
if caption
p.description= caption
if post.hasDate
p.description
span!= ll.pug_post_timestamp({post})
section.images-gallery
for entry in post.children
if entry.isVideo()
video(src=entry.getVideoUrlP() controls preload="auto" width=entry.data.dimensions && entry.data.dimensions.width height=entry.data.dimensions && entry.data.dimensions.height).sized-video
else
img(src=entry.getDisplayUrlP() alt=entry.getAlt() width=entry.data.dimensions && entry.data.dimensions.width height=entry.data.dimensions && entry.data.dimensions.height).sized-image
if willDisplayAltInGallery
- let caption = entry.data.accessibility_caption
if caption
p.description.alt-in-gallery= caption