diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/atomfeed.source.sh | 7 | ||||
| -rw-r--r-- | lib/generate.source.sh | 8 | ||||
| -rw-r--r-- | lib/log.source.sh | 4 |
3 files changed, 15 insertions, 4 deletions
diff --git a/lib/atomfeed.source.sh b/lib/atomfeed.source.sh index 65afa5a..7e7124d 100644 --- a/lib/atomfeed.source.sh +++ b/lib/atomfeed.source.sh @@ -143,6 +143,13 @@ ATOMENTRY </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 + # 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 log INFO 'Feed got something new!' diff --git a/lib/generate.source.sh b/lib/generate.source.sh index 9a9e90b..281fbe0 100644 --- a/lib/generate.source.sh +++ b/lib/generate.source.sh @@ -129,7 +129,7 @@ generate::fromgmi () { # Add content while read -r src; do # User can specify a content filter - if test ! -z "$CONTENT_FILTER" && ! $GREP -q "$CONTENT_FILTER" <<< "$src"; then + if test -n "$CONTENT_FILTER" && ! $GREP -q "$CONTENT_FILTER" <<< "$src"; then continue fi @@ -188,13 +188,13 @@ generate::fromgmi () { # Only generate draft posts generate::draft () { - if [ ! -z "$CONTENT_FILTER" ]; then + if [ -n "$CONTENT_FILTER" ]; then log ERROR "ERROR, you can't set a content filter manually in draft mode" exit 2 fi CONTENT_FILTER=DRAFT- - generate::fromgmi $@ + generate::fromgmi "$@" log INFO 'For HTML preview, open in your browser:' - find $CONTENT_BASE_DIR/html -name DRAFT-\*.html + find "$CONTENT_BASE_DIR/html" -name DRAFT-\*.html } diff --git a/lib/log.source.sh b/lib/log.source.sh index 2feb119..a93a35d 100644 --- a/lib/log.source.sh +++ b/lib/log.source.sh @@ -28,4 +28,8 @@ log::_pipe () { while read -r line; do echo "$level|$stamp|$pid|$callee|$line" >&2 done + + if [ "$level" = PANIC ]; then + exit 2 + fi } |
