summaryrefslogtreecommitdiff
path: root/src/categoriesbody
diff options
context:
space:
mode:
Diffstat (limited to 'src/categoriesbody')
-rwxr-xr-xsrc/categoriesbody28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/categoriesbody b/src/categoriesbody
new file mode 100755
index 0000000..c84c50b
--- /dev/null
+++ b/src/categoriesbody
@@ -0,0 +1,28 @@
+#!/bin/sh
+set -euo pipefail
+
+
+usage() {
+ echo 'Usage: categoriesbody FILENAME.conf'
+}
+
+FILENAME="${1:-}"
+eval "$(assert-arg -- "$FILENAME" 'FILENAME.conf')"
+. ./"$FILENAME"
+DIR="$(dirname -- "$FILENAME")"
+
+
+for catsortdata in `cat "$DIR"/categories.txt`; do
+ category="$(basename -- "$catsortdata" | cut -d. -f2)"
+ feedname=feed."$category".xml
+ cat <<EOF
+ <h2 id="$category">
+ <a href="#$category">$category</a>
+ <a href="$feedname">
+ <source srcset="$feedicon_url_prefix/dark.svg" media="(prefers-color-scheme: dark)" />
+ <img src="$feedicon_url_prefix/light.svg" class="icon" />
+ </a>
+ </h2>
+EOF
+ mkwb indexbody "$FILENAME" "$catsortdata"
+done