commit 9b27813b5b455a4b64198baf8534ddfca9fc72ad
parent af1aa44d3b96edb1a97b20eee59b73e9e4589b6b
Author: Dan Callaghan <djc@djc.id.au>
Date: Sat, 31 Oct 2026 11:50:06 +1100
add rudimentary alt text to screenshots
Diffstat:
3 files changed, 33 insertions(+), 11 deletions(-)
diff --git a/_plugins/responsive_images.rb b/_plugins/responsive_images.rb
@@ -1,3 +1,4 @@
+require 'cgi'
require 'open3'
def run_command *args
@@ -36,8 +37,11 @@ end
class ResponsiveImageTag < Liquid::Tag
def initialize tag_name, markup, tokens
super
- @src, *options = markup.split
- @lazy = options.include? "lazy"
+ @src = markup.split.first
+ @attributes = {}
+ markup.scan(Liquid::TagAttributes) do |key, value|
+ @attributes[key] = Liquid::Expression.parse value
+ end
end
def render context
@@ -51,7 +55,9 @@ class ResponsiveImageTag < Liquid::Tag
srcset = image[:widths].map { |w| "#{base}-#{w}w#{ext} #{w}w" }
srcset << "#{@src} #{image[:width]}w"
attrs = %(src="#{@src}" width="#{image[:width]}" height="#{image[:height]}" srcset="#{srcset.join(", ")}")
- attrs << (@lazy ? %( loading="lazy" sizes="auto, 100vw") : %( sizes="100vw"))
+ alt = context.evaluate @attributes["alt"]
+ attrs << %( alt="#{CGI.escapeHTML alt.to_s}") unless alt.nil?
+ attrs << (context.evaluate(@attributes["lazy"]) ? %( loading="lazy" sizes="auto, 100vw") : %( sizes="100vw"))
"<img #{attrs}>"
end
diff --git a/index.md b/index.md
@@ -9,7 +9,9 @@ It supports a very fast full-text search, automatic contact-list management, cus
If you're the type of person who treats email as an extension of your long-term memory, Sup is for you.
-<a href="screenshots/1.4/inbox.png">{% responsive_img screenshots/1.4/inbox.png %}</a>
+<a href="screenshots/1.4/inbox.png">
+ {% responsive_img screenshots/1.4/inbox.png alt: "Screenshot of Sup’s inbox-mode, showing a list of email threads." %}
+</a>
## Installation
Install the sup rubygem and run the sup-config utility to build a configuration:
diff --git a/screenshots/index.md b/screenshots/index.md
@@ -3,45 +3,59 @@ title: sup screenshots
layout: gallery
---
<figure>
- <a href="1.4/inbox.png">{% responsive_img 1.4/inbox.png lazy %}</a>
+ <a href="1.4/inbox.png">
+ {% responsive_img 1.4/inbox.png alt: "Screenshot of Sup’s inbox-mode, showing a list of email threads." lazy: true %}
+ </a>
<figcaption>
Sup starts in inbox-mode: a list of threads tagged <tt class="code">inbox</tt>.
</figcaption>
</figure>
<figure>
- <a href="1.4/search-results.png">{% responsive_img 1.4/search-results.png lazy %}</a>
+ <a href="1.4/search-results.png">
+ {% responsive_img 1.4/search-results.png alt: "Screenshot of Sup’s search-results-mode, showing a list of email threads matching a search query for “maildir”." lazy: true %}
+ </a>
<figcaption>
<a href="https://github.com/sup-heliotrope/sup/wiki/Searching-Your-Mail">Search your mail</a>
and Sup displays a list of matching threads in search-results-mode.
</figcaption>
</figure>
<figure>
- <a href="1.4/thread-view.png">{% responsive_img 1.4/thread-view.png lazy %}</a>
+ <a href="1.4/thread-view.png">
+ {% responsive_img 1.4/thread-view.png alt: "Screenshot of Sup’s thread-view-mode, showing a hierarchy of email messages." lazy: true %}
+ </a>
<figcaption>
In thread-view-mode, read messages are collapsed to a single line by default.
</figcaption>
</figure>
<figure>
- <a href="1.4/reply.png">{% responsive_img 1.4/reply.png lazy %}</a>
+ <a href="1.4/reply.png">
+ {% responsive_img 1.4/reply.png alt: "Screenshot of Sup’s reply-mode, showing email headers and a quoted reply as the body." lazy: true %}
+ </a>
<figcaption>
When replying to a message, reply-mode is pre-populated with quoted text.
Press <tt class="code">Enter</tt> to edit the reply in your preferred editor.
</figcaption>
</figure>
<figure>
- <a href="1.4/help.png">{% responsive_img 1.4/help.png lazy %}</a>
+ <a href="1.4/help.png">
+ {% responsive_img 1.4/help.png alt: "Screenshot of Sup’s help-mode, showing a list of key bindings." lazy: true %}
+ </a>
<figcaption>
Press <tt class="code">?</tt> in any mode to see the key bindings for the current mode.
</figcaption>
</figure>
<figure>
- <a href="1.4/log.png">{% responsive_img 1.4/log.png lazy %}</a>
+ <a href="1.4/log.png">
+ {% responsive_img 1.4/log.png alt: "Screenshot of Sup’s log-mode, showing debug log messages produced by Sup." lazy: true %}
+ </a>
<figcaption>
The log-mode buffer shows Sup’s internal log messages for debugging purposes.
</figcaption>
</figure>
<figure>
- <a href="1.4/console.png">{% responsive_img 1.4/console.png lazy %}</a>
+ <a href="1.4/console.png">
+ {% responsive_img 1.4/console.png alt: "Screenshot of Sup’s console-mode, showing a Ruby REPL which has evaluated some Ruby expressions." lazy: true %}
+ </a>
<figcaption>
Sup has a built-in interactive Ruby console.
It can access Sup internal Ruby objects.