hugosoucycc

[ARCHIVED] Another old source code of <hugo.soucy.cc>.
Log | Files | Refs | Submodules

commit 6bccc1fada86efabda53986be350dfc7ef163819
parent df02646fb40518c1f8dc353f8e03ecf33c7738ec
Author: Hugo Soucy <hugo.soucy@savoirfairelinux.com>
Date:   Sun,  6 Nov 2016 19:23:46 -0500

Create a function for creating the atom feed.

Diffstat:
Afunctions/create-feed | 30++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+), 0 deletions(-)

diff --git a/functions/create-feed b/functions/create-feed @@ -0,0 +1,30 @@ +#!/bin/bash + +# Create the Atom feed from the flat database +create_feed () { + while read feed_entry; do + field_date=`echo $feed_entry | cut -d "|" -f 1` + field_datetime=`echo $feed_entry | cut -d "|" -f 2` + field_permalink=`echo $feed_entry | cut -d "|" -f 3` + field_title=`echo $feed_entry | cut -d "|" -f 4` + + echo "<entry>" + echo "<title>$field_title</title>" + echo "<link href=\"$field_permalink\" />" + echo "<updated>$field_date""T$field_datetime</updated>" + echo "<author>" + echo "<name>$SITE_AUTHOR</name>" + echo "<email>$SITE_AUTHOR_EMAIL</email>" + echo "</author>" + echo "</entry>" + + done < "$FAKESTACHE_PATH"/"$DB" > feed.atom.xhtml + + # This is for the feed + pandoc -t html "$FAKESTACHE_PATH/feed.atom.xhtml" -s \ + --template="$TPL_PANDOC_PATH/feed.txt" \ + -o "$PUBLICHTML/feed.atom.xml" \ + --parse-raw + + rm "$FAKESTACHE_PATH/feed.atom.xhtml" +}