summaryrefslogtreecommitdiff
path: root/add_to_rss.sh
diff options
context:
space:
mode:
authorb4rkod <lllillilll@protonmail.com>2024-05-15 23:50:36 +0300
committerb4rkod <lllillilll@protonmail.com>2024-05-15 23:50:36 +0300
commit0e97f4e9e7672743bc9b04a2efa0b68d7f9bfa14 (patch)
tree49c7f49b5d04ceed2e94c3aa8945a5d2cf3dc64a /add_to_rss.sh
parent3624bc6c786a438c429615589225da9e121e42c9 (diff)
redid everything, not at the documentation stage
Diffstat (limited to 'add_to_rss.sh')
-rwxr-xr-xadd_to_rss.sh9
1 files changed, 5 insertions, 4 deletions
diff --git a/add_to_rss.sh b/add_to_rss.sh
index 0c4e0b3..c829f9f 100755
--- a/add_to_rss.sh
+++ b/add_to_rss.sh
@@ -1,7 +1,8 @@
-BASE=$(basename $1|sed s/txt$/html/)
-FILE=$(cat $1|sed -E ':a;N;$!ba; s/\/\/\///g ;s/\//\\\//g ; s/\r{0,1}\n/<\\\/p>/g;s/^/<p>/;')
-echo $BASE
+FILE=$(cat $1 | sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g'| sed "s#\/#\\\/#g" )
-sed -i "/<\!--item-->/s/$/\n\<item><pubDate><\/pubDate><guid>https:\/\/b4rkod.net.tr\/$BASE<\/guid><title>$BASE<\/title><link>https:\/\/b4rkod.net.tr\/blogposts\/$BASE<\/link><description><![CDATA[$FILE]]><\/description><\/item>/" "$HOME/www/source/rss.xml"
+BASE=$(basename $1)
+
+RSS_DATE=$(date -d "$(stat -c %w $1)" -R)
+sed -i "/<\!--item-->/s/$/\n<item>\n<pubDate>$RSS_DATE<\/pubDate>\n<guid>https:\/\/b4rkod.net.tr\/$BASE<\/guid>\n<title>$BASE<\/title>\n<link>https:\/\/b4rkod.net.tr\/blogposts\/$BASE<\/link>\n<description><![CDATA[$FILE]]><\/description>\n<\/item>/" "$HOME/www/source/rss.xml"