summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2022-08-28 10:17:08 +0100
committerPaul Buetow <paul@buetow.org>2022-08-28 10:17:08 +0100
commit072e1eef2e56f28a4b9c0540e5bd31a8002592d1 (patch)
tree0eb8a65252a0a7c4512f2eeef2901d83ec68c054 /lib
parent35213c97cebe88d413c33ec9b2f4e03a7dc7f3ce (diff)
then there are no notes and no feeds dont process them
Diffstat (limited to 'lib')
-rw-r--r--lib/atomfeed.source.sh4
-rw-r--r--lib/gemfeed.source.sh7
-rw-r--r--lib/generate.source.sh4
-rw-r--r--lib/notes.source.sh5
4 files changed, 19 insertions, 1 deletions
diff --git a/lib/atomfeed.source.sh b/lib/atomfeed.source.sh
index 391842a..c5e492f 100644
--- a/lib/atomfeed.source.sh
+++ b/lib/atomfeed.source.sh
@@ -82,6 +82,10 @@ atomfeed::content () {
# Generate an atom.xml feed file.
atomfeed::generate () {
local -r gemfeed_dir="$CONTENT_BASE_DIR/gemtext/gemfeed"
+ if [ ! -d "$gemfeed_dir" ]; then
+ return
+ fi
+
local -r atom_file="$gemfeed_dir/atom.xml"
local -r now=$($DATE --iso-8601=seconds)
log INFO "Generating Atom feed to $atom_file"
diff --git a/lib/gemfeed.source.sh b/lib/gemfeed.source.sh
index aee70d3..8eaeb95 100644
--- a/lib/gemfeed.source.sh
+++ b/lib/gemfeed.source.sh
@@ -24,12 +24,17 @@ gemfeed::updatemainindex () {
gemfeed::_get_word_count () {
local -r gmi_file="$1"; shift
- $SED '/^```/,/^```/d' "$gmi_file" | wc -w
+ sed '/^```/,/^```/d' "$gmi_file" | wc -w | cut -d' ' -f1
}
# Generate a index.gmi in the ./gemfeed subdir.
gemfeed::generate () {
local -r gemfeed_dir="$CONTENT_BASE_DIR/gemtext/gemfeed"
+ if [ ! -d "$gemfeed_dir" ]; then
+ log INFO "Capsule without Gemfeed"
+ return
+ fi
+
log INFO "Generating Gemfeed index for $gemfeed_dir"
cat <<GEMFEED > "$gemfeed_dir/index.gmi.tmp"
diff --git a/lib/generate.source.sh b/lib/generate.source.sh
index f72f84b..5392163 100644
--- a/lib/generate.source.sh
+++ b/lib/generate.source.sh
@@ -63,6 +63,10 @@ generate::convert_gmi_atom_to_html_atom () {
return
fi
+ if [ ! -f "$CONTENT_BASE_DIR/gemtext/gemfeed/atom.xml" ]; then
+ return
+ fi
+
log INFO 'Converting Gemtext Atom feed to HTML Atom feed'
$SED 's|.gmi|.html|g; s|gemini://|https://|g' \
diff --git a/lib/notes.source.sh b/lib/notes.source.sh
index b82631d..0f5251d 100644
--- a/lib/notes.source.sh
+++ b/lib/notes.source.sh
@@ -11,6 +11,11 @@ notes::_get_notes () {
# Generate a index.gmi in the ./notes subdir.
notes::generate () {
local -r notes_dir="$CONTENT_BASE_DIR/gemtext/notes"
+ if [ ! -d "$notes_dir" ]; then
+ log INFO "Capsule without Notes section"
+ return
+ fi
+
log INFO "Generating Notes index for $notes_dir"
cat <<NOTES > "$notes_dir/index.gmi.tmp"