From eef3c3e516c1b89f4a30d068a672dd00dd59f7b5 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 6 Jun 2021 10:11:14 -0300 Subject: 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. --- Makefile | 24 ++++++++++++----------- README.md | 19 ++++++++++++++++++ aux/workflow/README.sh | 45 ------------------------------------------- aux/workflow/assert-readme.sh | 36 ++++++++++++++++++++++++++++++++++ aux/workflow/commonmark.sh | 3 ++- aux/workflow/public.sh | 2 +- 6 files changed, 71 insertions(+), 58 deletions(-) delete mode 100755 aux/workflow/README.sh create mode 100755 aux/workflow/assert-readme.sh diff --git a/Makefile b/Makefile index 6abcc41..1b95d76 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,15 @@ .POSIX: -CC = c99 -CFLAGS = -std=c99 -Wall -Wextra -Wpedantic -fPIC -g -O3 -LDFLAGS = -Wl,-rpath,$$LIBRARY_PATH -LDLIBS = -PREFIX = /usr/local -MANPREFIX = $(PREFIX)/share/man -VERSION = 0.2.1 -DATE = 2021-02-23 -DEFS = -DVERSION='"$(VERSION)"' -DDATE='"$(DATE)"' -NAME = remembering +CC = c99 +CFLAGS = -std=c99 -Wall -Wextra -Wpedantic -fPIC -g -O3 +LDFLAGS = -Wl,-rpath,$$LIBRARY_PATH +LDLIBS = +PREFIX = /usr/local +MANPREFIX = $(PREFIX)/share/man +VERSION = 0.2.1 +DATE = 2021-02-23 +DEFS = -DVERSION='"$(VERSION)"' -DDATE='"$(DATE)"' +NAME = remembering +MAILING_LIST = public-inbox sources = src/remembering.c @@ -47,6 +48,7 @@ dev-check: check fallible-tests sh aux/assert-shellcheck.sh sh aux/workflow/assert-todos.sh sh aux/workflow/assert-changelog.sh $(NAME) + sh aux/workflow/assert-readme.sh $(NAME) $(MAILING_LIST) clean: rm -rf public/ tests/test-profiles/ remembering remembering-sh remembering-c run-tests fallible* vgcore* remembering-test.* @@ -71,7 +73,7 @@ dist: sh aux/workflow/dist.sh $(DATE) $(VERSION) $(NAME) public: README.md TODOs.md CHANGELOG.md $(manpages) - sh aux/workflow/public.sh Remembering $(NAME) public-inbox + sh aux/workflow/public.sh Remembering $(NAME) $(MAILING_LIST) for m in $(manpages); do groff -m man -Thtml $$m > public/`basename $$m`.html; done .PHONY: all clean check dev-check dist install uninstall diff --git a/README.md b/README.md index ce0e2d7..d4c312b 100644 --- a/README.md +++ b/README.md @@ -64,3 +64,22 @@ and for generating the documentation HTML and website, run: ```shell $ make public ``` + + +# Links + +- [home page](https://remembering.euandreh.xyz) +- [source code](https://git.euandreh.xyz/remembering/) +- [bug tracking](https://remembering.euandreh.xyz/TODOs.html) +- [mailing list](https://lists.sr.ht/~euandreh/public-inbox?search=%5Bremembering%5D) +- [CI logs](https://remembering.euandreh.xyz/ci.html) +- [CHANGELOG](https://remembering.euandreh.xyz/CHANGELOG.html) + + +# Releases + +- version [v0.2.1](https://git.euandreh.xyz/remembering/snapshot/remembering-v0.2.1.tar.gz) ([sig](https://git.euandreh.xyz/remembering/snapshot/remembering-v0.2.1.tar.gz.asc)), released in 2021-02-23 +- version [v0.2.0](https://git.euandreh.xyz/remembering/snapshot/remembering-v0.2.0.tar.gz) ([sig](https://git.euandreh.xyz/remembering/snapshot/remembering-v0.2.0.tar.gz.asc)), released in 2021-02-21 +- version [v0.1.2](https://git.euandreh.xyz/remembering/snapshot/remembering-v0.1.2.tar.gz) ([sig](https://git.euandreh.xyz/remembering/snapshot/remembering-v0.1.2.tar.gz.asc)), released in 2021-01-26 +- version [v0.1.1](https://git.euandreh.xyz/remembering/snapshot/remembering-v0.1.1.tar.gz) ([sig](https://git.euandreh.xyz/remembering/snapshot/remembering-v0.1.1.tar.gz.asc)), released in 2021-01-26 +- version [v0.1.0](https://git.euandreh.xyz/remembering/snapshot/remembering-v0.1.0.tar.gz) ([sig](https://git.euandreh.xyz/remembering/snapshot/remembering-v0.1.0.tar.gz.asc)), released in 2021-01-26 diff --git a/aux/workflow/README.sh b/aux/workflow/README.sh deleted file mode 100755 index 51ab5bf..0000000 --- a/aux/workflow/README.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh -set -eu - -mkdir -p public - -PROJECT_UC="$1" -PROJECT="$2" -MAILING_LIST="$3" - -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 - -RELEASES="$(mktemp)" -if [ -s "$RELEASES_LIST" ]; then - printf '\n# Releases\n\n' >> "$RELEASES" - cat "$RELEASES_LIST" >> "$RELEASES" -fi - -LINKS="$(mktemp)" -cat < "$LINKS" - -# Links - -- [home page](https://$PROJECT.euandreh.xyz) -- [source code](https://git.euandreh.xyz/$PROJECT/) -- [bug tracking](https://$PROJECT.euandreh.xyz/TODOs.html) -- [mailing list](https://lists.sr.ht/~euandreh/$MAILING_LIST?search=%5B$PROJECT%5D) -- [CI logs](https://$PROJECT.euandreh.xyz/ci.html) -- [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 diff --git a/aux/workflow/assert-readme.sh b/aux/workflow/assert-readme.sh new file mode 100755 index 0000000..47f7e25 --- /dev/null +++ b/aux/workflow/assert-readme.sh @@ -0,0 +1,36 @@ +#!/bin/sh +set -eu + +mkdir -p public + +PROJECT="$1" +MAILING_LIST="$2" + +EXPECTED="$(mktemp)" +cat <> "$EXPECTED" + + +# Links + +- [home page](https://$PROJECT.euandreh.xyz) +- [source code](https://git.euandreh.xyz/$PROJECT/) +- [bug tracking](https://$PROJECT.euandreh.xyz/TODOs.html) +- [mailing list](https://lists.sr.ht/~euandreh/$MAILING_LIST?search=%5B$PROJECT%5D) +- [CI logs](https://$PROJECT.euandreh.xyz/ci.html) +- [CHANGELOG](https://$PROJECT.euandreh.xyz/CHANGELOG.html) +EOF + +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 -- cgit v1.2.3