about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2020-11-18 20:39:36 -0600
committerCase Duckworth2020-11-18 20:39:36 -0600
commit4ab498046204b5cff8ba75ed619f1c8ae7d2ca6f (patch)
tree04786d54d6b6dc819cb19b78917889373f6b9fc5
parentMake executable (diff)
downloadshatom-4ab498046204b5cff8ba75ed619f1c8ae7d2ca6f.tar.gz
shatom-4ab498046204b5cff8ba75ed619f1c8ae7d2ca6f.zip
Fix up
-rwxr-xr-xgemshimfeed28
1 files changed, 20 insertions, 8 deletions
diff --git a/gemshimfeed b/gemshimfeed index a3eb3c0..3025182 100755 --- a/gemshimfeed +++ b/gemshimfeed
@@ -21,9 +21,10 @@ END
21FEED_TITLE=example 21FEED_TITLE=example
22FEED_SUBTITLE="an example" 22FEED_SUBTITLE="an example"
23FEED_URL="https://example.com/atom.xml" 23FEED_URL="https://example.com/atom.xml"
24SITE_URL="https://example.com/" 24SITE_URL="https://example.com"
25FEED_ID="example.com" 25FEED_ID="${SITE_URL#*//}"
26FEED_COPYRIGHT="(c) 2020 CC-BY-SA nobody" 26FEED_AUTHOR="nobody"
27FEED_COPYRIGHT="(c) 2020 CC-BY-SA $FEED_AUTHOR"
27FEED_UPDATED=$(date -u +'%FT%TZ') 28FEED_UPDATED=$(date -u +'%FT%TZ')
28 29
29# FUNCTIONS 30# FUNCTIONS
@@ -56,7 +57,12 @@ entry_url() {
56} 57}
57 58
58entry_title() { 59entry_title() {
59 awk '/^#+[ ]\S/{for(i=2;i<=NF;i++)print $i;}' 60 awk '/^#+[ ]\S/{
61 for(i=2;i<=NF;i++) {
62 printf $i;
63 if (i!=NF) printf " ";
64 }
65 printf "\n";exit}' "$1"
60} 66}
61 67
62entry_summary() { 68entry_summary() {
@@ -64,7 +70,7 @@ entry_summary() {
64} 70}
65 71
66entry_author() { 72entry_author() {
67 echo "nobody" 73 echo "$FEED_AUTHOR"
68} 74}
69 75
70entry_content() { 76entry_content() {
@@ -93,7 +99,7 @@ atom_header() {
93<link href="$FEED_URL" rel="self" /> 99<link href="$FEED_URL" rel="self" />
94<link href="$SITE_URL" /> 100<link href="$SITE_URL" />
95<id>$FEED_ID</id> 101<id>$FEED_ID</id>
96<generator uri="https://git.sr.ht/~acdw/gemshimfeed" version="infinite>GemShimFeed</generator> 102<generator uri="https://git.sr.ht/~acdw/gemshimfeed" version="infinite">GemShimFeed</generator>
97<rights>$FEED_COPYRIGHT</rights> 103<rights>$FEED_COPYRIGHT</rights>
98<updated>$FEED_UPDATED</updated> 104<updated>$FEED_UPDATED</updated>
99END 105END
@@ -138,15 +144,21 @@ main() {
138 ;; 144 ;;
139 esac 145 esac
140 146
141 . "$CONFIGFILE" || : 147 if [ -f "CONFIGFILE" ]; then
148 . "$CONFIGFILE"
149 fi
142 150
143 atom_header 151 atom_header
144 for DIR; do 152 for DIR; do
145 for entry in $(recent_files "$DIR" -type f); do 153 for entry in $(recent_files "$DIR" -type f); do
146 if skip_file "$entry"; then continue; fi 154 if skip_entry "$entry"; then continue; fi
147 155
148 atom_entry "$entry" 156 atom_entry "$entry"
149 done 157 done
150 done 158 done
151 atom_footer 159 atom_footer
152} 160}
161
162if [ $DEBUG ]; then set -x; fi
163
164main "$@"