Test RSS Support
This commit is contained in:
@ -29,16 +29,51 @@ do
|
||||
fi
|
||||
|
||||
# replace placeholders
|
||||
sed -i "s/PREVPADINT/$padintprev/g" "$tailname"
|
||||
sed -i "s/NEXTPADINT/$padintnext/g" "$tailname"
|
||||
sed " s/PREVPADINT/$padintprev/g;
|
||||
s/NEXTPADINT/$padintnext/g" filetail > "$tailname"
|
||||
fi
|
||||
|
||||
# cat together
|
||||
# cat together for blog page
|
||||
if [[ -f $contentname ]] ;then
|
||||
cat filehead "$contentname" "$tailname" "$quotename" > "$blogname"
|
||||
fi
|
||||
done
|
||||
|
||||
# compile items for rss
|
||||
cd ../blog || exit
|
||||
|
||||
# get replace point in templates
|
||||
linereplace=$(grep -n '$itemlist' .rss.template | cut -f1 -d:)
|
||||
itemlinereplace=$(grep -n '$item' .rss.item.template | cut -f1 -d:)
|
||||
|
||||
# build rss feed
|
||||
cat \
|
||||
<(head -n $(( linereplace -1 )) .rss.template) \
|
||||
<(
|
||||
for ((i=1;i<10;i++))
|
||||
do
|
||||
itemnum=$(( CONTENTNUM - i ))
|
||||
padint=$(printf %03d $itemnum)
|
||||
title=$(jq '.data | .['"$padint"'].title' .data.json )
|
||||
pubdate=$(jq '.data | .['"$padint"'].published_date' .data.json )
|
||||
guid=$(jq '.data | .['"$padint"'].guid' .data.json )
|
||||
cat \
|
||||
<(head -n $(( itemlinereplace -1 )) .rss.item.template |
|
||||
sed "s/TITLE/$title/;
|
||||
s/CURRENTINT/$padint/"
|
||||
) \
|
||||
<(cat content-$padint quote-$padint |
|
||||
tidy -q -asxml |
|
||||
xq -cx '.html.body' ) \
|
||||
<(tail -n +$(( itemlinereplace +1 )) .rss.item.template |
|
||||
sed "s/PUBDATE/$pubdate/;
|
||||
s/GUID/$guid/"
|
||||
)
|
||||
done
|
||||
) \
|
||||
<(tail -n +$(( linereplace +1 )) .rss.template) \
|
||||
> rss.xml
|
||||
|
||||
# clean up non prod files, lock down permissions, and self-destruct
|
||||
cd ../blog || exit
|
||||
\rm filehead filetail content* quote* .blog.* tail*
|
||||
@ -46,3 +81,6 @@ cd ../ || exit
|
||||
\rm -rf .git scripts .index.html.* README.md Jenkinsfile
|
||||
find . -type f -exec chmod 600 {} \;
|
||||
find . -type d -exec chmod 700 {} \;
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user