From 0d821ad64483d27281c87fe85e56eb346398e808 Mon Sep 17 00:00:00 2001 From: /dev/urandom Date: Tue, 6 Apr 2021 17:07:17 +0300 Subject: [PATCH] trying to add descriptions to RSS --- blogrss.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/blogrss.sh b/blogrss.sh index 2057794..aeb3b90 100755 --- a/blogrss.sh +++ b/blogrss.sh @@ -6,6 +6,18 @@ FILES=`ls $DIRECTORY/*.md -1 | sort` RETURNDATE="" +function printcut { +# argument 1: filename + + CUT=`grep -m 1 -n '[[:space:]]*' $1` + if [ -n "$CUT" ]; then + CUTLINE=`echo "$CUT" | cut -d ':' -f 1` + head -n $(($CUTLINE - 1)) $1 | grep -v '^%' + else + return 1 + fi +} + # date is read from the 3rd %ed line of the document or from the git commit date function getdate { @@ -68,6 +80,12 @@ for f in $FILES; do echo "$RDATE" fi echo "" + DESCRIPTION="`printcut $f`" + if [ $? -eq 0 ]; then + DESC_HTML=`echo "$DESCRIPTION" | markdown` + echo "$DESC_HTML" + fi + done cat << RSSFOOTER