mirror of
https://gitea.phreedom.club/localhost_frssoft/dybr2fedi.git
synced 2024-12-01 19:06:37 +00:00
43 lines
1 KiB
Bash
Executable file
43 lines
1 KiB
Bash
Executable file
#!/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/&/\&/g; s/</\</g; s/>/\>/g; s/"/\"/g; s/'"'"'/\'/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
|