the ugly shellscript powering https://oppi.li
at main 1.3 kB view raw
1<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> 2 <channel> 3 <title>oppiliappan's μblog</title> 4 <link>https://oppi.li</link> 5 <description>programming, design, software</description> 6 <atom:link href="https://oppi.li/index.xml" rel="self" type="application/rss+xml" /> 7 <image> 8 <title>oppiliappan's μblog</title> 9 <url>https://cdn.oppi.li/n.png</url> 10 <link>https://oppi.li</link> 11 </image> 12 <language>en-us</language> 13 <copyright>Creative Commons BY-NC-SA 4.0</copyright> 14 <% for f in `ls -t ./posts`; do 15 file="./posts/"$f 16 post_date=$(date -u -r "$file" "+%a, %d %b %Y %H:%M:00 %z") 17 html=$(pandoc -t html "$file" | sed -e "s/&/\&amp;/g" -e "s/</\&lt;/g" -e "s/>/\&gt;/g") 18 id="${file##*/}" 19 id="${id%.*}" 20 post_title=$(echo "$id" | sed -E -e "s/\..+$//g" -e "s/_(.)/ \u\1/g" -e "s/^(.)/\u\1/g") 21 post_link="https://oppi.li/posts/$id/" 22 23 echo "<item>" 24 25 echo "<title>$post_title</title>" 26 echo "<description>$html</description>" 27 echo "<link>$post_link</link>" 28 echo "<pubDate>$post_date</pubDate>" 29 echo "<guid>$post_link</guid>" 30 31 echo "</item>" 32 33 done 34 %> 35 36 </channel> 37</rss>