natalie-webbed-site/scripts/img-caption
2024-07-27 13:59:26 -07:00

12 lines
223 B
Bash
Executable File

#!/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>"