#!/bin/sh base_url='https://blog.ce9e.org/' getyml() { grep "^$1:" "$2" | head -n 1 | sed "s/$1"': //;s/^"\(.*\)"$/\1/' } escape() { sed 's/&/\&/g; s//\>/g; s/"/\"/g' } echo '' echo '' echo ' Tobias Bengfort' echo ' Ξ' echo " $base_url" echo " $(date '+%Y-%m-%d')T00:00:00Z" echo " " if [ "$1" = '-a' ]; then echo " " echo " " select='tail -n +11' else echo " " echo " " select='head -n 10' fi ls _content/posts | tac | $select | while read -r l; do yml="_content/posts/$l/index.md" html="_content/posts/$l/index.html" url="${base_url}posts/$l/" echo ' ' echo " $(getyml 'title' "$yml" | escape)" echo " " echo " $url" echo " $(getyml 'date' "$yml" | escape)T00:00:00Z" echo " $(getyml 'description' "$yml" | escape)" echo ' ' cat "$html" | escape echo ' ' echo ' ' done echo ''