X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;ds=sidebyside;f=processor%2Ffeed.xml.do;h=0bc7318b0dc881bd094b81a17254d1977a5d48a8;hb=cc2d161a6ef0700f6d08fd5c63314834a7264c28;hp=2b4396957954b5eab9c021a0d3695c1fb2a7dfcb;hpb=6ee5e0e20b722b1d4e72dfa52a19ec684cb30410;p=redo-blog diff --git a/processor/feed.xml.do b/processor/feed.xml.do index 2b43969..0bc7318 100644 --- a/processor/feed.xml.do +++ b/processor/feed.xml.do @@ -1,8 +1,8 @@ #!/bin/sh # Pull in global dependencies. -metadata_dir=.meta -. "$metadata_dir"/helpers.sh +. ./helpers.sh +metadata_dir=metadata author_file="$metadata_dir"/author uuid_file="$metadata_dir"/uuid title_file="$metadata_dir"/title @@ -47,7 +47,11 @@ for file in ./*.rst ./*.md; do done # Derive feed modification date from snippets. -mod_dates=$(grep -hE "^" ./${metadata_dir}/*.feed_snippet | sed -E 's/<.?updated>//g') +n_snippet_files=`ls -1 ./${metadata_dir}/*.feed_snippet 2>/dev/null | wc -l` +if [ $n_snippet_files != 0 ] +then + mod_dates=$(grep -hE "^" ./${metadata_dir}/*.feed_snippet | sed -E 's/<.?updated>//g') +fi last_mod_unix=0 for date in $mod_dates; do date_unix=$(date -u "+%s" -d "${date}") @@ -60,8 +64,10 @@ printf "%s\n\n" "$lastmod_rfc3339" # Write feed entries. for file in ./${tmp_snippets_dir}/*; do - cat "${file}" - printf "\n" + if [ -e "$file" ]; then + cat "${file}" + printf "\n" + fi done rm -rf "$tmp_snippets_dir"