diff options
author | EuAndreh <eu@euandre.org> | 2025-04-30 07:42:56 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2025-04-30 07:42:56 -0300 |
commit | 7452082adf9df08fa231b1ac0aa2048d3e32f72e (patch) | |
tree | 991793d501cfdb4bda33abba2df0c69d9e453840 /src/indexbody | |
parent | Add "mapentry" and "sitemap" subcommands (diff) | |
download | mkwb-7452082adf9df08fa231b1ac0aa2048d3e32f72e.tar.gz mkwb-7452082adf9df08fa231b1ac0aa2048d3e32f72e.tar.xz |
src/categoriesbody: Omit listing header
Diffstat (limited to 'src/indexbody')
-rwxr-xr-x | src/indexbody | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/indexbody b/src/indexbody index eaef320..75d7f1d 100755 --- a/src/indexbody +++ b/src/indexbody @@ -3,16 +3,32 @@ set -euo pipefail usage() { - echo 'Usage: indexbody FILENAME.conf [SORTDATA]' + echo 'Usage: indexbody [-n] FILENAME.conf [SORTDATA]' } + +EMIT_HEADER=true +while getopts 'n' flag; do + case "$flag" in + (n) + EMIT_HEADER=false + ;; + (*) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + FILENAME="${1:-}" SORTDATA="${2:-"$(dirname -- "$FILENAME")"/sortdata.txt}" eval "$(assert-arg -- "$FILENAME" 'FILENAME.conf')" . ./"$FILENAME" -cat <<EOF +header() { + cat <<EOF <p> Atom feed <a href="feed.xml"><img src="$feedicon_url" class="icon" /></a> @@ -20,6 +36,11 @@ cat <<EOF <a href="categories.html">categories</a>. </p> EOF +} + +if [ "$EMIT_HEADER" = true ]; then + header +fi printf ' <ol class="collection-list">\n' cat -- "$SORTDATA" | |