#!/bin/sh
set -euo pipefail
usage() {
echo 'Usage: html FILENAME.htmlbody'
}
FILENAME="${1:-}"
eval "$(assert-arg -- "$FILENAME" 'FILENAME.htmlbody')"
. "$(realpath -- "${FILENAME%.*}.conf")"
dates() {
if [ -z "$date_formatted" ]; then
return
fi
cat <
Posted on
EOF
if [ -n "$updatedat_formatted" ]; then
cat <
Updated on
EOF
fi
cat <
EOF
}
h1() {
if [ "${custom_body:-}" = true ]; then
return
fi
cat <
$title_html
EOF
}
comments() {
if [ "${custom_body:-}" = true ]; then
return
fi
cat <
EOF
}
head_meta_author_html=
if [ -n "${author:-}" ]; then
head_meta_author_html=" "
fi
headlinks() {
if [ -z "${header_links:-}" ]; then
return
fi
echo ' '
while read -r line; do
link="$(printf '%s\n' "$line" | cut -d' ' -f1)"
name="$(printf '%s\n' "$line" | cut -d' ' -f2)"
cat <
$name
EOF
done < "$header_links"
echo '
'
}
collection_head_prev_html=
collection_head_post_html=
cat <
$head_meta_author_html
$collection_head_prev_html
$collection_head_post_html
$titlefull_html
EOF
h1
dates
cat "$FILENAME"
comments
cat <
EOF