summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2023-03-12 12:14:42 +0200
committerPaul Buetow <paul@buetow.org>2023-03-12 12:14:42 +0200
commitee37696cac6c9742aca34e5ada38bfa1b2ed68ef (patch)
tree02f6ff38e46569546f56ac9d05282a964ed66200
parent921a1067f48b4c044335601610b6ba704aaa3cf9 (diff)
refactor and better lint logging
-rw-r--r--lib/atomfeed.source.sh21
1 files changed, 14 insertions, 7 deletions
diff --git a/lib/atomfeed.source.sh b/lib/atomfeed.source.sh
index 7e7124d..41b3fb5 100644
--- a/lib/atomfeed.source.sh
+++ b/lib/atomfeed.source.sh
@@ -142,13 +142,7 @@ ATOMENTRY
cat <<ATOMFOOTER >> "$atom_file.tmp"
</feed>
ATOMFOOTER
-
- if [ -n "$XMLLINT" ]; then
- log INFO 'XMLLinting Atom feed'
- $XMLLINT "$atom_file.tmp" >/dev/null ||
- log PANIC "Atom feed $atom_file.tmp isn't valid XML, please re-try"
- log INFO 'Atom feed is OK'
- fi
+ atomfeed::_xmllint "$atom_file.tmp"
# Delete the 3rd line of the atom feeds (global feed update timestamp)
if ! diff -u <($SED 3d "$atom_file") <($SED 3d "$atom_file.tmp"); then
@@ -159,3 +153,16 @@ ATOMFOOTER
rm "$atom_file.tmp"
fi
}
+
+atomfeed::_xmllint () {
+ local -r atom_feed="$1"
+
+ if [ -n "$XMLLINT" ]; then
+ log INFO 'XMLLinting Atom feed'
+ $XMLLINT "$atom_feed" >/dev/null ||
+ log PANIC "Atom feed $atom_feed isn't valid XML, please re-try"
+ log INFO 'Atom feed is OK'
+ else
+ log WARN 'Skipping XMLLinting Atom feed as "xmllint" command is no installed!'
+ fi
+}