#!/bin/sh set -eu usage() { echo 'Usage: feed FILENAME' } FILENAME="${1:-}" eval "$(assert-arg -- "$FILENAME" 'FILENAME')" absolute() { printf 'https://domain-here.com/%s' "$(cat -)" } feed_article_title='' site_name=' ' lang=en now="$(date -uIs)" url_absolute="$(printf '%s' "${FILENAME#src/}" | absolute)" site_name_html="$(htmlesc "${site_name:?}")" collection=article collection_url_absolute="$(printf '%s' ${lang:?}/ | absolute)" feed_title_html="$(eval "echo \"\$feed_${collection}_title\"" | htmlesc)" export now url_absolute site_name_html collection_url_absolute feed_title_html DIR="$(dirname "$FILENAME")" author= email= cat < $site_name_html $feed_title_html $url_absolute $now $author $email EOF find "$@" | xargs cat | sort -nr | xargs cat printf '\n'