1
0
forked from nat/webbed-site
webbed-site/scripts/img-caption

12 lines
223 B
Plaintext
Raw Normal View History

2024-07-27 13:59:26 -07:00
#!/bin/bash
path=$1
caption=$2
if [ -z "${caption}" ]; then
caption="$(basename "$path" | sed 's/-/ /g; s/\.[^.]*$//')"
fi
echo "<figure><img src='$path' alt='$caption'><figcaption>$caption</figcaption></figure>"