Files
website/build/build-index.sh
T
Andrew Rioux 519138983d
Deploy Website / build-and-deploy (push) Successful in 3m14s
fix: lint issues
2026-05-30 22:41:35 -04:00

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