24 lines
851 B
Bash
Executable File
24 lines
851 B
Bash
Executable File
#!/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 '<li>'
|
|
echo '<a href="'"${article/.org/}.html"'">'"<date>$DATE</date> - $TITLE"'</a>'
|
|
echo '<p>'
|
|
awk '/^\*\*+/ { found_header = 0; found_first_header = 1 } /.+/ { if (found_header) { print } } /^\* / { if (!found_first_header) { found_header = 1 } }' < "$article"
|
|
echo '</p>'
|
|
echo '</li>'
|
|
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
|