From 4ab498046204b5cff8ba75ed619f1c8ae7d2ca6f Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Wed, 18 Nov 2020 20:39:36 -0600 Subject: Fix up --- gemshimfeed | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/gemshimfeed b/gemshimfeed index a3eb3c0..3025182 100755 --- a/gemshimfeed +++ b/gemshimfeed @@ -21,9 +21,10 @@ END FEED_TITLE=example FEED_SUBTITLE="an example" FEED_URL="https://example.com/atom.xml" -SITE_URL="https://example.com/" -FEED_ID="example.com" -FEED_COPYRIGHT="(c) 2020 CC-BY-SA nobody" +SITE_URL="https://example.com" +FEED_ID="${SITE_URL#*//}" +FEED_AUTHOR="nobody" +FEED_COPYRIGHT="(c) 2020 CC-BY-SA $FEED_AUTHOR" FEED_UPDATED=$(date -u +'%FT%TZ') # FUNCTIONS @@ -56,7 +57,12 @@ entry_url() { } entry_title() { - awk '/^#+[ ]\S/{for(i=2;i<=NF;i++)print $i;}' + awk '/^#+[ ]\S/{ + for(i=2;i<=NF;i++) { + printf $i; + if (i!=NF) printf " "; + } + printf "\n";exit}' "$1" } entry_summary() { @@ -64,7 +70,7 @@ entry_summary() { } entry_author() { - echo "nobody" + echo "$FEED_AUTHOR" } entry_content() { @@ -93,7 +99,7 @@ atom_header() { $FEED_ID -GemShimFeed $FEED_COPYRIGHT $FEED_UPDATED END @@ -138,15 +144,21 @@ main() { ;; esac - . "$CONFIGFILE" || : + if [ -f "CONFIGFILE" ]; then + . "$CONFIGFILE" + fi atom_header for DIR; do for entry in $(recent_files "$DIR" -type f); do - if skip_file "$entry"; then continue; fi + if skip_entry "$entry"; then continue; fi atom_entry "$entry" done done atom_footer } + +if [ $DEBUG ]; then set -x; fi + +main "$@" -- cgit 1.4.1-21-gabe81