Fixed broken dates and updated docs

This commit is contained in:
2022-03-15 00:39:01 +08:00
parent 7173e38b90
commit ed81d58d42
3 changed files with 16 additions and 20 deletions

View File

@ -1,13 +1,9 @@
<item> <item>
<title>TITLE</title> <title>TITLE</title>
<link> <link>https://www.clementchiew.me/blog/blog-CURRENTINT</link>
https://www.clementchiew.me/blog/blog-CURRENTINT
</link>
<description> <description>
$item $item
</description> </description>
<pubDate>PUBDATE</pubDate> <pubDate>PUBDATE</pubDate>
<guid> <guid>GUID</guid>
GUID
</guid>
</item> </item>

View File

@ -1,12 +1,12 @@
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel> <channel>
<title>My Little Spot</title> <title>My Little Spot</title>
<link>https://www.clementchiew.me.</link> <link>https://www.clementchiew.me</link>
<description> </description> <description> </description>
<language>en-us</language> <language>en-us</language>
<pubDate>PUBDATE</pubDate> <pubDate>PUBDATE</pubDate>
<lastBuildDate>PUBDATE</lastBuildDate> <lastBuildDate>PUBDATE</lastBuildDate>
<docs>https://www.clement.chiew/blog/rss</docs> <docs>https://www.rssboard.org/rss-specification</docs>
<generator>Some random bash scripts</generator> <generator>Some random bash scripts</generator>
<managingEditor>clementchiew95@disroot.org (Clement Chiew)</managingEditor> <managingEditor>clementchiew95@disroot.org (Clement Chiew)</managingEditor>
<webMaster>clementchiew95@disroot.org (Clement Chiew)</webMaster> <webMaster>clementchiew95@disroot.org (Clement Chiew)</webMaster>

View File

@ -53,22 +53,22 @@ cat \
<( <(
for ((i=1;i<10;i++)) for ((i=1;i<10;i++))
do do
itemnum=$(( CONTENTNUM - i )) export padint=$( printf %03d $(( CONTENTNUM -i )) )
padint=$(printf %03d $itemnum)
title=$(jq -r '.data | .['"$padint"'].title' .data.json )
pubdate=$(jq -r '.data | .['"$padint"'].published_date' .data.json )
guid=$(jq -r '.data | .['"$padint"'].guid' .data.json )
cat \ cat \
<(head -n $(( itemlinereplace -1 )) .rss.item.template | <(
sed "s/TITLE/$title/; head -n $(( itemlinereplace -1 )) .rss.item.template |
s/CURRENTINT/$padint/" title=$(jq -r '.data | .['"$padint"'].title' .data.json ) \
perl -pe 's/TITLE/$ENV{title}/; s/CURRENTINT/$ENV{padint}/'
) \ ) \
<(cat content-$padint quote-$padint | <(
cat content-$padint quote-$padint |
tidy -q -asxml | tidy -q -asxml |
xq -cx '.html.body' ) \ xq -cx '.html.body' ) \
<(tail -n +$(( itemlinereplace +1 )) .rss.item.template | <(
sed "s/PUBDATE/$pubdate/; tail -n +$(( itemlinereplace +1 )) .rss.item.template |
s/GUID/$guid/" pubdate=$(jq -r '.data | .['"$padint"'].published_date' .data.json ) \
guid=$(jq -r '.data | .['"$padint"'].guid' .data.json ) \
perl -pe 's/PUBDATE/$ENV{pubdate}/; s/GUID/$ENV{guid}/'
) )
done done
) \ ) \