#!/usr/bin/env bash LINKS="$(find articles -name '*.org' | tac | head -n 10 | while read -r article; do TITLE="$(grep -E '^#\+TITLE:' "$article" | sed -e 's/^#+TITLE:\s*//')" ARTICLE_COMMIT="$(git rev-list -1 HEAD -- "$article")" DATE="$(git show --no-patch --no-notes --pretty='%as' "$ARTICLE_COMMIT")" echo '
  • ' echo ''"$DATE - $TITLE"'' echo '

    ' awk '/^\*\*+/ { found_header = 0; found_first_header = 1 } /.+/ { if (found_header) { print } } /^\* / { if (!found_first_header) { found_header = 1 } }' < "$article" echo '

    ' echo '
  • ' done)" if [ -f index.html.in ]; then FILE=index.html.in else FILE=index.html fi awk '/LINK_INSERT/ { at_stop = 1 } { if (!at_stop) { print } }' < $FILE echo "$LINKS" awk '{ if (at_start) { print } } /LINK_INSERT/ { at_start = 1 }' < $FILE