diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/categoriesbody | 2 | ||||
-rwxr-xr-x | src/indexbody | 25 |
2 files changed, 24 insertions, 3 deletions
diff --git a/src/categoriesbody b/src/categoriesbody index 2d2a9b5..4ce7c73 100755 --- a/src/categoriesbody +++ b/src/categoriesbody @@ -21,5 +21,5 @@ for catsortdata in `cat "$DIR"/categories.txt`; do <a href="$feedname"><img src="$feedicon_url" class="icon" /></a> </h2> EOF - mkwb indexbody "$FILENAME" "$catsortdata" + mkwb indexbody -n "$FILENAME" "$catsortdata" done 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" | |