xfwc (990B)
1 #!/bin/bash 2 3 ABSURL="https://xfnw.ttm.sh/xfwc" 4 5 cat <<EOF > feed.rss 6 <?xml version="1.0" encoding="UTF-8" ?> 7 <rss version="2.0"> 8 9 <channel> 10 <title>xfwc</title> 11 <link>$ABSURL/</link> 12 <description>xfwc</description> 13 14 EOF 15 16 17 TOTAL=$(ls src | wc -w) 18 19 rm index.html 20 21 ln -s $TOTAL.html index.html 22 23 TOTAL=$(( TOTAL )) 24 NUM=$(( TOTAL )) 25 for fn in $(ls -t src); do 26 NEWF=$NUM.html 27 TITLE=$(echo ${fn%????} | sed 's/_/ /g' | sed -e 's/[]$.*[\^]/\\&/g') 28 echo "rendering $NEWF..." 29 30 echo " 31 <item> 32 <title>$TITLE</title> 33 <link>$ABSURL/$NEWF</link> 34 <description>image #$NUM</description> 35 </item> 36 " >> feed.rss 37 38 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 39 40 [ "$NUM" = "1" ] || sed -i "s/#PRE/"$(( NUM - 1 ))"/" $NEWF 41 42 [ "$NUM" = "$TOTAL" ] || sed -i "s/#NEXT/"$(( NUM + 1 ))"/" $NEWF 43 44 45 NUM=$(( NUM - 1 )) 46 47 done 48 49 cat <<EOF >> feed.rss 50 </channel> 51 </rss> 52 EOF 53 54