Compare commits

...

4 Commits

Author SHA1 Message Date
localhost_frssoft d82fc393d1 fix relative link 2023-01-08 18:53:29 +03:00
localhost_frssoft 5489ac0104 fix relative link 2023-01-08 18:39:49 +03:00
localhost_frssoft 030076d6a9 removed content section 2023-01-08 18:19:48 +03:00
localhost_frssoft b0fd0ba45b Add some worst rss/atom generator 2023-01-08 18:05:37 +03:00
2 changed files with 44 additions and 1 deletions

View File

@ -54,5 +54,6 @@ for i in $(jj -l -i "$basedir"/response.json 'data.#.id'); do
echo "=> $raw_id.gmi $title ($published)" | cat - $baseblogdir/index.gmi > $basedir/tmp && mv tmp $baseblogdir/index.gmi
fi
done
#
$basedir/rss_atom_gen.sh $baseblogdir > $baseblogdir/atom.xml

42
rss_atom_gen.sh Executable file
View File

@ -0,0 +1,42 @@
#!/bin/sh
atom_xml() {
cat <<EOF
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Ледяной автобус в Нифльхейм</title>
<link href="$uri" rel="self" />
<updated>$(date --iso=seconds)</updated>
<author>
<name>Лиэс.</name>
</author>
<id>tag:default-atom-feed</id>
EOF
for i in $1/*.gmi; do
if [ -n "$(echo "$i" | grep -Eo 'atom|index')" ]; then continue; fi
raw_id=$(echo "$i" | rev | cut -d'/' -f 1 | rev)
title=$(head -n 1 $i | tr -d '#')
created=$(date -r $i --iso-8601=seconds)
updated=$created
if [ "$created" = "draft" ]; then continue; fi
day=$(echo "$created" | sed 's/T.*//')
#content=$($MARKDOWN "$f" | sed 's/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g; s/"/\&quot;/g; s/'"'"'/\&#39;/g')
cat <<EOF
<entry>
<title>$title</title>
<link href="$(echo "$raw_id")"/>
<id>tag:$day:$raw_id</id>
<published>$created</published>
<updated>$updated</updated>
</entry>
EOF
done
echo '</feed>'
}
uri="pub.phreedom.club/~localhost/Lies_dybr/" atom_xml $1