From 43f1bb6b8b2c80a68d332fb887a35b10d89a626e Mon Sep 17 00:00:00 2001 From: Philip Wittamore Date: Thu, 8 May 2025 22:20:43 +0200 Subject: update --- blogrss | 46 ++++++++++++++++++++-------------------------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/blogrss b/blogrss index 59f8f3f..2a818ac 100755 --- a/blogrss +++ b/blogrss @@ -1,6 +1,5 @@ #!/bin/bash -title=Bloggings link=https://wittamore.com/articles/2025 description='Ramblings from Brittany, France' rsslink=https://wittamore.com/rss.xml @@ -23,40 +22,36 @@ updated=$(date --iso-8601=ns) # Build RSS header & footer header () { -echo """ - -""" > ~/feedtop -echo """ +echo " +" > ~/feedtop +echo " Bloggings - wittamore.com https://wittamore.com Ramblings from Brittany, France $updated -""" >> ~/feedtop +" >> ~/feedtop } footer () { -echo """ +echo " -""" >> ~/feedbottom +" >> ~/feedbottom } # Function: Build Item add to feed item () { - echo """ - $fullTitle - $postdate - $linkadd - $linkadd - - $description - - - """ >> ~/feed + echo " + $fullTitle$postdate + $linkadd + $linkadd + + $description +" >> ~/feed } # Function: Concatenate everything @@ -75,19 +70,18 @@ if [[ -f $feedname ]]; then rm $feedname fi touch $feedname -postArray=( $(ls -t "$postDir"/*.html) ) -numPosts=$(ls "$postDir"/*.html | wc -l) +#postArray=( $(ls -t "$postDir"/*.html) ) +mapfile -t postArray < <(ls -t "$postDir"/*.html) postNum=0 for posts in "${postArray[@]}"; do - let postNum+=1 + ((postNum+=1)) post=$posts - fullTitle=$(grep -o '>.*' $post | sed 's/\(>\|<\/h2>\)//g') - postdate=$(grep -o '>.*' $post | sed 's/\(>\|<\/h5>\)//g') + fullTitle=$(grep -o '>.*' "$post" | sed 's/\(>\|<\/h2>\)//g') + postdate=$(grep -o '>.*' "$post" | sed 's/\(>\|<\/h5>\)//g') postname=${post##*/} linkadd="$link"/"$postname" - guid=$postNum - description=$(sed -n '/

.*/,/*.<\/h4>/{p;q;}' $post | sed -e 's/<[^>]\+>/ /g' -e 's|

||g' -e 's|

||g' -e 's|"||g') - item $post + description=$(sed -n '/

.*/,/*.<\/h4>/{p;q;}' "$post" | sed -e 's/<[^>]\+>/ /g' -e 's|

||g' -e 's|

||g' -e 's|"||g') + item "$post" done combine exit -- cgit v1.2.3