home
·
contact
·
privacy
projects
/
redo-blog
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
To feed generator, add handler for case of empty blog.
[redo-blog]
/
processor
/
feed.xml.do
diff --git
a/processor/feed.xml.do
b/processor/feed.xml.do
index 2b4396957954b5eab9c021a0d3695c1fb2a7dfcb..0bc7318b0dc881bd094b81a17254d1977a5d48a8 100644
(file)
--- a/
processor/feed.xml.do
+++ b/
processor/feed.xml.do
@@
-1,8
+1,8
@@
#!/bin/sh
# Pull in global dependencies.
#!/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
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.
done
# Derive feed modification date from snippets.
-mod_dates=$(grep -hE "^<updated>" ./${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 "^<updated>" ./${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}")
last_mod_unix=0
for date in $mod_dates; do
date_unix=$(date -u "+%s" -d "${date}")
@@
-60,8
+64,10
@@
printf "<updated>%s</updated>\n\n" "$lastmod_rfc3339"
# Write feed entries.
for file in ./${tmp_snippets_dir}/*; do
# 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"
done
rm -rf "$tmp_snippets_dir"