aboutsummaryrefslogtreecommitdiff
path: root/aux/workflow
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2021-06-06 10:11:14 -0300
committerEuAndreh <eu@euandre.org>2021-06-06 10:11:14 -0300
commiteef3c3e516c1b89f4a30d068a672dd00dd59f7b5 (patch)
tree1cad065719ae9e1149944e3f8a9a94c12189145c /aux/workflow
parentaux/: Use tabs over spaces for .sh files (diff)
downloadremembering-eef3c3e516c1b89f4a30d068a672dd00dd59f7b5.tar.gz
remembering-eef3c3e516c1b89f4a30d068a672dd00dd59f7b5.tar.xz
README.md: Add explicit "Links" and "Releases" sections
Instead of generating the "Links" and "Releases" sections on the fly and adding them to the end of the README.md before processing it with aux/workflow/README.sh, embed those sections directly and use aux/workflow/assert-readme.sh to make sure the metadata is there. Before we had: 1. generate "Links" and "Releases" on the fly inside aux/workflow/README.sh; 2. add those sections to the end of the README.md; 3. use the custom pandoc build command inside the aux/workflow/README.sh file. Now we have: 1. embed "Links" and "Releases" in the README.md directly; 2. use aux/workflow/assert-readme.sh to validate the correct metadata; 3. use the vanilla aux/workflow/commonmark.sh to generate the HTML.
Diffstat (limited to 'aux/workflow')
-rwxr-xr-xaux/workflow/assert-readme.sh (renamed from aux/workflow/README.sh)45
-rwxr-xr-xaux/workflow/commonmark.sh3
-rwxr-xr-xaux/workflow/public.sh2
3 files changed, 21 insertions, 29 deletions
diff --git a/aux/workflow/README.sh b/aux/workflow/assert-readme.sh
index 51ab5bf..47f7e25 100755
--- a/aux/workflow/README.sh
+++ b/aux/workflow/assert-readme.sh
@@ -3,23 +3,12 @@ set -eu
mkdir -p public
-PROJECT_UC="$1"
-PROJECT="$2"
-MAILING_LIST="$3"
+PROJECT="$1"
+MAILING_LIST="$2"
-RELEASES_LIST="$(mktemp)"
-for version in $(git tag | perl -e 'print reverse <>'); do
- echo "- version [$version](https://git.euandreh.xyz/$PROJECT/snapshot/$PROJECT-$version.tar.gz) ([sig](https://git.euandreh.xyz/$PROJECT/snapshot/$PROJECT-$version.tar.gz.asc)), released in $(git log -1 --format=%cd --date=short "$version")" >> "$RELEASES_LIST"
-done
+EXPECTED="$(mktemp)"
+cat <<EOF >> "$EXPECTED"
-RELEASES="$(mktemp)"
-if [ -s "$RELEASES_LIST" ]; then
- printf '\n# Releases\n\n' >> "$RELEASES"
- cat "$RELEASES_LIST" >> "$RELEASES"
-fi
-
-LINKS="$(mktemp)"
-cat <<EOF > "$LINKS"
# Links
@@ -31,15 +20,17 @@ cat <<EOF > "$LINKS"
- [CHANGELOG](https://$PROJECT.euandreh.xyz/CHANGELOG.html)
EOF
-cat "README.md" "$LINKS" "$RELEASES" | \
- pandoc \
- --toc \
- --highlight-style pygments \
- --toc-depth=2 \
- -s \
- --metadata title="$PROJECT_UC - README" \
- --metadata lang=en \
- -r commonmark \
- -w html \
- -H aux/workflow/favicon.html \
- > public/index.html
+RELEASES_LIST="$(mktemp)"
+for version in $(git tag | perl -e 'print reverse <>'); do
+ echo "- version [$version](https://git.euandreh.xyz/$PROJECT/snapshot/$PROJECT-$version.tar.gz) ([sig](https://git.euandreh.xyz/$PROJECT/snapshot/$PROJECT-$version.tar.gz.asc)), released in $(git log -1 --format=%cd --date=short "$version")" >> "$RELEASES_LIST"
+done
+
+if [ -s "$RELEASES_LIST" ]; then
+ printf '\n\n# Releases\n\n' >> "$EXPECTED"
+ cat "$RELEASES_LIST" >> "$EXPECTED"
+fi
+
+if ! tail -n "$(wc -l < "$EXPECTED")" README.md | diff - "$EXPECTED"; then
+ echo 'Missing metadata at the end of README.md file'
+ exit 1
+fi
diff --git a/aux/workflow/commonmark.sh b/aux/workflow/commonmark.sh
index e97751b..6016f51 100755
--- a/aux/workflow/commonmark.sh
+++ b/aux/workflow/commonmark.sh
@@ -5,6 +5,7 @@ mkdir -p public
PROJECT_UC="$1"
F="$2"
+OUT="${3:-${F%.*}.html}"
pandoc \
--toc \
@@ -16,4 +17,4 @@ pandoc \
-r commonmark \
-w html \
-H aux/workflow/favicon.html \
- < "$F" > "public/${F%.*}.html"
+ < "$F" > "public/$OUT"
diff --git a/aux/workflow/public.sh b/aux/workflow/public.sh
index b8840db..14a8e65 100755
--- a/aux/workflow/public.sh
+++ b/aux/workflow/public.sh
@@ -6,7 +6,7 @@ PROJECT="$2"
MAILING_LIST="$3"
sh aux/workflow/TODOs.sh "$PROJECT_UC" "$PROJECT" "$MAILING_LIST"
-sh aux/workflow/README.sh "$PROJECT_UC" "$PROJECT" "$MAILING_LIST"
+sh aux/workflow/commonmark.sh "$PROJECT" README.md index.html
if [ -f CHANGELOG.md ]; then
sh aux/workflow/commonmark.sh "$PROJECT" CHANGELOG.md