webbed-site/scripts/img-caption

12 lines
243 B
Bash
Executable File

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