This commit is contained in:
Case Duckworth 2020-11-18 20:39:36 -06:00
parent 895dae10f7
commit 4ab4980462
1 changed files with 20 additions and 8 deletions

View File

@ -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() {
<link href="$FEED_URL" rel="self" />
<link href="$SITE_URL" />
<id>$FEED_ID</id>
<generator uri="https://git.sr.ht/~acdw/gemshimfeed" version="infinite>GemShimFeed</generator>
<generator uri="https://git.sr.ht/~acdw/gemshimfeed" version="infinite">GemShimFeed</generator>
<rights>$FEED_COPYRIGHT</rights>
<updated>$FEED_UPDATED</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 "$@"