diff options
author | Case Duckworth | 2020-11-18 20:39:36 -0600 |
---|---|---|
committer | Case Duckworth | 2020-11-18 20:39:36 -0600 |
commit | 4ab498046204b5cff8ba75ed619f1c8ae7d2ca6f (patch) | |
tree | 04786d54d6b6dc819cb19b78917889373f6b9fc5 /gemshimfeed | |
parent | Make executable (diff) | |
download | shatom-4ab498046204b5cff8ba75ed619f1c8ae7d2ca6f.tar.gz shatom-4ab498046204b5cff8ba75ed619f1c8ae7d2ca6f.zip |
Fix up
Diffstat (limited to 'gemshimfeed')
-rwxr-xr-x | gemshimfeed | 28 |
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 | |||
21 | FEED_TITLE=example | 21 | FEED_TITLE=example |
22 | FEED_SUBTITLE="an example" | 22 | FEED_SUBTITLE="an example" |
23 | FEED_URL="https://example.com/atom.xml" | 23 | FEED_URL="https://example.com/atom.xml" |
24 | SITE_URL="https://example.com/" | 24 | SITE_URL="https://example.com" |
25 | FEED_ID="example.com" | 25 | FEED_ID="${SITE_URL#*//}" |
26 | FEED_COPYRIGHT="(c) 2020 CC-BY-SA nobody" | 26 | FEED_AUTHOR="nobody" |
27 | FEED_COPYRIGHT="(c) 2020 CC-BY-SA $FEED_AUTHOR" | ||
27 | FEED_UPDATED=$(date -u +'%FT%TZ') | 28 | FEED_UPDATED=$(date -u +'%FT%TZ') |
28 | 29 | ||
29 | # FUNCTIONS | 30 | # FUNCTIONS |
@@ -56,7 +57,12 @@ entry_url() { | |||
56 | } | 57 | } |
57 | 58 | ||
58 | entry_title() { | 59 | entry_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 | ||
62 | entry_summary() { | 68 | entry_summary() { |
@@ -64,7 +70,7 @@ entry_summary() { | |||
64 | } | 70 | } |
65 | 71 | ||
66 | entry_author() { | 72 | entry_author() { |
67 | echo "nobody" | 73 | echo "$FEED_AUTHOR" |
68 | } | 74 | } |
69 | 75 | ||
70 | entry_content() { | 76 | entry_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> |
99 | END | 105 | END |
@@ -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 | |||
162 | if [ $DEBUG ]; then set -x; fi | ||
163 | |||
164 | main "$@" | ||