mirror of
https://git.sr.ht/~cadence/bibliogram
synced 2024-11-22 08:07:30 +00:00
Option to show alt text if available (closes #49)
This commit is contained in:
parent
3282d81ec4
commit
ca1c965021
@ -4,6 +4,10 @@ mixin post(post, headerWithNavigation)
|
|||||||
.post-page-divider(class={
|
.post-page-divider(class={
|
||||||
"caption-on-right": settings.caption_side === "right"
|
"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
|
section.description-section
|
||||||
.user-header
|
.user-header
|
||||||
header.user-header-inner
|
header.user-header-inner
|
||||||
@ -18,14 +22,26 @@ mixin post(post, headerWithNavigation)
|
|||||||
img(src="/static/img/arrow-circled.svg" alt="Previous post.").icon.previous
|
img(src="/static/img/arrow-circled.svg" alt="Previous post.").icon.previous
|
||||||
button(data-next).navigate-posts
|
button(data-next).navigate-posts
|
||||||
img(src="/static/img/arrow-circled.svg" alt="Next post.").icon
|
img(src="/static/img/arrow-circled.svg" alt="Next post.").icon
|
||||||
|
|
||||||
div.relative-box
|
div.relative-box
|
||||||
div.scrolling-box
|
div.scrolling-box
|
||||||
if post.getCaption()
|
if post.getCaption()
|
||||||
p.structured-text.description
|
p.structured-text.description
|
||||||
+display_structured(post.getStructuredCaption())
|
+display_structured(post.getStructuredCaption())
|
||||||
|
|
||||||
|
if willDisplayAltInDescription
|
||||||
|
each child in post.children
|
||||||
|
- let caption = child.data.accessibility_caption
|
||||||
|
if caption
|
||||||
|
p.description= caption
|
||||||
|
|
||||||
section.images-gallery
|
section.images-gallery
|
||||||
for entry in post.children
|
for entry in post.children
|
||||||
if entry.isVideo()
|
if entry.isVideo()
|
||||||
video(src=entry.getVideoUrlP() controls preload="auto" width=entry.data.dimensions.width height=entry.data.dimensions.height).sized-video
|
video(src=entry.getVideoUrlP() controls preload="auto" width=entry.data.dimensions.width height=entry.data.dimensions.height).sized-video
|
||||||
else
|
else
|
||||||
img(src=entry.getDisplayUrlP() alt=entry.getAlt() width=entry.data.dimensions.width height=entry.data.dimensions.height).sized-image
|
img(src=entry.getDisplayUrlP() alt=entry.getAlt() width=entry.data.dimensions.width height=entry.data.dimensions.height).sized-image
|
||||||
|
if willDisplayAltInGallery
|
||||||
|
- let caption = entry.data.accessibility_caption
|
||||||
|
if caption
|
||||||
|
p.description.alt-in-gallery= caption
|
||||||
|
@ -81,7 +81,7 @@ html
|
|||||||
{value: "right", text: "Right (Instagram)"}
|
{value: "right", text: "Right (Instagram)"}
|
||||||
])
|
])
|
||||||
|
|
||||||
+checkbox("display_alt", "Display alt text inline", "Display", true)
|
+checkbox("display_alt", "Display alt text inline", "Display", false)
|
||||||
|
|
||||||
//- div
|
//- div
|
||||||
//- Here are all the possible input styles. Uncomment to test styling.
|
//- Here are all the possible input styles. Uncomment to test styling.
|
||||||
|
@ -272,6 +272,20 @@ body
|
|||||||
.description-section
|
.description-section
|
||||||
order: 1
|
order: 1
|
||||||
|
|
||||||
|
.description
|
||||||
|
margin: 12px
|
||||||
|
white-space: pre-line
|
||||||
|
overflow-wrap: anywhere
|
||||||
|
font-size: 20px
|
||||||
|
line-height: 1.4
|
||||||
|
unicode-bidi: plaintext
|
||||||
|
|
||||||
|
@media screen and (min-width: $layout-b-min)
|
||||||
|
padding-bottom: 20px
|
||||||
|
|
||||||
|
@media screen and (max-width: $layout-a-max)
|
||||||
|
font-size: 18px
|
||||||
|
|
||||||
.description-section
|
.description-section
|
||||||
display: grid
|
display: grid
|
||||||
align-items: stretch
|
align-items: stretch
|
||||||
@ -358,19 +372,6 @@ body
|
|||||||
display: grid
|
display: grid
|
||||||
align-items: center
|
align-items: center
|
||||||
|
|
||||||
.description
|
|
||||||
margin: 12px
|
|
||||||
white-space: pre-line
|
|
||||||
overflow-wrap: anywhere
|
|
||||||
font-size: 20px
|
|
||||||
line-height: 1.4
|
|
||||||
unicode-bidi: plaintext
|
|
||||||
@media screen and (min-width: $layout-b-min)
|
|
||||||
padding-bottom: 20px
|
|
||||||
|
|
||||||
@media screen and (max-width: $layout-a-max)
|
|
||||||
font-size: 18px
|
|
||||||
|
|
||||||
.images-gallery
|
.images-gallery
|
||||||
display: flex
|
display: flex
|
||||||
flex-direction: column
|
flex-direction: column
|
||||||
@ -400,6 +401,13 @@ body
|
|||||||
width: auto
|
width: auto
|
||||||
height: auto
|
height: auto
|
||||||
|
|
||||||
|
.alt-in-gallery
|
||||||
|
color: map-get($theme, "foreground-gallery-alt")
|
||||||
|
padding: 0px 50px
|
||||||
|
margin: 0px 0px 50px
|
||||||
|
text-align: center
|
||||||
|
font-size: 20px
|
||||||
|
|
||||||
.error-page
|
.error-page
|
||||||
box-sizing: border-box
|
box-sizing: border-box
|
||||||
min-height: 100vh
|
min-height: 100vh
|
||||||
|
Loading…
Reference in New Issue
Block a user