53 lines
1011 B
Bash
Executable File
53 lines
1011 B
Bash
Executable File
#!/bin/bash
|
|
|
|
ABSURL="https://xfnw.ttm.sh/xfwc"
|
|
|
|
cat <<EOF > feed.rss.new
|
|
<?xml version="1.0" encoding="UTF-8" ?>
|
|
<rss version="2.0">
|
|
|
|
<channel>
|
|
<title>xfwc</title>
|
|
<link>$ABSURL/</link>
|
|
<description>xfwc</description>
|
|
|
|
EOF
|
|
|
|
|
|
TOTAL=$(ls src | wc -w)
|
|
|
|
TOTAL=$(( TOTAL ))
|
|
NUM=$(( TOTAL ))
|
|
for fn in $(ls -t src); do
|
|
NEWF=$NUM.html
|
|
TITLE=$(echo ${fn%????} | sed 's/_/ /g' | sed -e 's/[]$.*[\^]/\\&/g')
|
|
echo "rendering $NEWF..."
|
|
|
|
echo "
|
|
<item>
|
|
<title>$TITLE</title>
|
|
<link>$ABSURL/$NEWF</link>
|
|
<description>image #$NUM</description>
|
|
</item>
|
|
" >> feed.rss.new
|
|
|
|
sed "s/<!-- COMIC -->/<img class='comic' alt='$TITLE' title='$TITLE' src='src\/$fn'\/>/; s/XFSSTITLE/$TITLE/g; s/RANDOM/"$(( ( RANDOM % TOTAL ) + 1 ))"/; s/LAST/$TOTAL/" template/page.html > $NEWF
|
|
|
|
[ "$NUM" = "1" ] || sed -i "s/#PRE/"$(( NUM - 1 ))"/" $NEWF
|
|
|
|
[ "$NUM" = "$TOTAL" ] || sed -i "s/#NEXT/"$(( NUM + 1 ))"/" $NEWF
|
|
|
|
|
|
NUM=$(( NUM - 1 ))
|
|
|
|
done
|
|
|
|
cat <<EOF >> feed.rss.new
|
|
</channel>
|
|
</rss>
|
|
EOF
|
|
|
|
ln -s $TOTAL.html index.html
|
|
mv feed.rss.new feed.rss
|
|
|