aboutsummaryrefslogtreecommitdiff
path: root/aux/workflow
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2022-03-06 02:29:37 -0300
committerEuAndreh <eu@euandre.org>2022-03-06 02:29:37 -0300
commit8f6060c5fe07c475cd53c367ab791251168ab460 (patch)
tree44ba6bfa1a0e3debbb70944839c3a682d3ee7c53 /aux/workflow
parentaux/: Update (diff)
downloadtoph-8f6060c5fe07c475cd53c367ab791251168ab460.tar.gz
toph-8f6060c5fe07c475cd53c367ab791251168ab460.tar.xz
aux/: Update
Diffstat (limited to 'aux/workflow')
-rwxr-xr-xaux/workflow/TODOs.sh13
-rwxr-xr-xaux/workflow/assert-changelog.sh2
-rwxr-xr-xaux/workflow/assert-readme.sh6
-rwxr-xr-xaux/workflow/assert-todos.sh61
-rwxr-xr-xaux/workflow/commonmark.sh10
-rwxr-xr-xaux/workflow/dist.sh15
-rw-r--r--aux/workflow/preamble.md2
-rwxr-xr-xaux/workflow/public.sh28
-rw-r--r--aux/workflow/style.css115
9 files changed, 142 insertions, 110 deletions
diff --git a/aux/workflow/TODOs.sh b/aux/workflow/TODOs.sh
index efc0b04..05cf3cb 100755
--- a/aux/workflow/TODOs.sh
+++ b/aux/workflow/TODOs.sh
@@ -40,20 +40,13 @@ if [ -z "${PROJECT_UC:-}" ]; then
fi
-# shellcheck disable=1004
-IDS_REGEX='s:^## \(TODO\|DOING\|WAITING\|MEETING\|INACTIVE\|NEXT\|CANCELLED\|DONE\|WONTFIX\) \(.*\) {#\(.*\)}\(.*\)$:## <a href="#\3"><span class="\1">\1</span> \2</a>\4\
-<pre class="header-anchor" id="\3">#\3</pre>\
-:g'
-TAGS_REGEX='s|tag:\([a-z0-9-]*\)|<span class="tag">\1</span>|g'
-
-cat aux/workflow/preamble.md TODOs.md |
+td -H |
+ cat aux/workflow/preamble.md - |
sed \
-e "s:@PROJECT_UC@:$PROJECT_UC:g" \
-e "s:@PROJECT@:$PROJECT:g" \
-e "s:@MAILING_LIST@:$MAILING_LIST:g" \
- -e "s:@TLD@:$TLD:g" \
- -e "$IDS_REGEX" \
- -e "$TAGS_REGEX" |
+ -e "s:@TLD@:$TLD:g" |
pandoc \
--toc \
--highlight-style pygments \
diff --git a/aux/workflow/assert-changelog.sh b/aux/workflow/assert-changelog.sh
index 4acc81b..c58a600 100755
--- a/aux/workflow/assert-changelog.sh
+++ b/aux/workflow/assert-changelog.sh
@@ -44,7 +44,7 @@ assert() {
VVERSION="$2"
VERSION="${2#v}"
CHANGELOG_ENTRY="$(printf \
- '# [%s](https://git.euandreh.xyz/%s/commit/?id=%s) - %s' \
+ '# [%s](https://euandreh.xyz/%s.git/commit/?id=%s) - %s' \
"$VERSION" "$PROJECT" "$VVERSION" "$DATE")"
if ! grep -qF "$CHANGELOG_ENTRY" CHANGELOG.md; then
echo "Missing '$CHANGELOG_ENTRY' entry from CHANGELOG.md" >&2
diff --git a/aux/workflow/assert-readme.sh b/aux/workflow/assert-readme.sh
index 1e49bfb..0a85221 100755
--- a/aux/workflow/assert-readme.sh
+++ b/aux/workflow/assert-readme.sh
@@ -55,7 +55,7 @@ Send contributions to the [mailing list] via
## Links
- [homepage](https://$TLD/$PROJECT/en/)
-- [source code](https://git.euandreh.xyz/$PROJECT/)
+- [source code](https://euandreh.xyz/$PROJECT.git/)
- [bug tracking](https://$TLD/$PROJECT/TODOs.html)
- [mailing list]
- [CI logs](https://$TLD/$PROJECT/ci.html)
@@ -68,7 +68,7 @@ RELEASES_LIST="$(mkstemp)"
add_release() {
DATE="$1"
VVERSION="$2"
- echo "- [$VVERSION](https://git.euandreh.xyz/$PROJECT/commit/?id=$VVERSION) [$PROJECT-$VVERSION.tar.gz](https://git.euandreh.xyz/$PROJECT/snapshot/$PROJECT-$VVERSION.tar.gz) ([sig](https://git.euandreh.xyz/$PROJECT/snapshot/$PROJECT-$VVERSION.tar.gz.asc)) - $DATE" >> "$RELEASES_LIST"
+ echo "- [$VVERSION](https://euandreh.xyz/$PROJECT.git/commit/?id=$VVERSION) [$PROJECT-$VVERSION.tar.gz](https://euandreh.xyz/$PROJECT.git/snapshot/$PROJECT-$VVERSION.tar.gz) ([sig](https://euandreh.xyz/$PROJECT.git/snapshot/$PROJECT-$VVERSION.tar.gz.asc)) - $DATE" >> "$RELEASES_LIST"
}
for VVERSION in $(git tag); do
@@ -98,7 +98,7 @@ The code is licensed under
[GNU Affero General Public License v3.0 or later][AGPL-3.0-or-later]
(AGPL-3.0-or-later).
-[AGPL-3.0-or-later]: https://git.euandreh.xyz/$PROJECT/tree/COPYING
+[AGPL-3.0-or-later]: https://euandreh.xyz/$PROJECT.git/tree/COPYING
EOF
if ! tail -n "$(wc -l < "$EXPECTED")" README.md | diff - "$EXPECTED"; then
diff --git a/aux/workflow/assert-todos.sh b/aux/workflow/assert-todos.sh
index bc4907d..f4fd965 100755
--- a/aux/workflow/assert-todos.sh
+++ b/aux/workflow/assert-todos.sh
@@ -1,58 +1,15 @@
#!/bin/sh
set -eu
-if [ -e .git ] && git grep FIXME | grep -v '^TODOs.md' |
- grep -v '^aux/workflow/assert-todos.sh'; then
- echo "Found dangling FIXME markers on the project."
- echo "You should write them down properly on TODOs.md."
+# shellcheck disable=2086
+if [ -e .git ] &&
+ git grep FIXME ${1:-} |
+ grep -v '^TODOs.md:' |
+ grep -v '^aux/workflow/assert-todos.sh:'
+then
+ echo "Found dangling FIXME markers on the project." >&2
+ echo "You should write them down properly on TODOs.md." >&2
exit 1
fi
-awk -F'{#' '
-BEGIN {
- exitstatus = 0
- h2flag = 0
- h2status = ""
- prevline = ""
- idx = 0
- delete ids[0]
-}
-h2flag == 1 {
- split($0, l, " ")
- timelinestatus = l[2]
- if (h2status != timelinestatus) {
- print "h2/timeline status mismatch for line " NR-1
- print prevline
- print $0
- exitstatus = 1
- }
- h2status = ""
- h2flag = 0
-}
-
-/^## (TODO|DOING|WAITING|MEETING|INACTIVE|NEXT|CANCELLED|DONE|WONTFIX)/ {
- if (match($0, / \{#.*?\}.*$/) == 0) {
- print "Missing ID for line " NR ":\n" $0
- exitstatus = 1
- }
- id_with_prefix = substr($2, 0, length($2) - 1)
- match(id_with_prefix, /^\w+-/)
- id = substr(id_with_prefix, RLENGTH + 1)
- if (id in arr) {
- print "Duplicate ID: " id
- exitstatus = 1
- } else {
- arr[id] = 1
- }
-
- split($0, l, " ")
- h2status = l[2]
- h2flag = 1
- prevline = $0
-}
-
-
-/^# Scratch$/ {
- exit exitstatus
-}
-' TODOs.md
+td -L
diff --git a/aux/workflow/commonmark.sh b/aux/workflow/commonmark.sh
index 6f5e59b..088d447 100755
--- a/aux/workflow/commonmark.sh
+++ b/aux/workflow/commonmark.sh
@@ -1,7 +1,7 @@
#!/bin/sh
set -eu
-while getopts 'N:t:l:' flag; do
+while getopts 'N:t:l:H:' flag; do
case "$flag" in
N)
PROJECT_UC="$OPTARG"
@@ -12,6 +12,9 @@ while getopts 'N:t:l:' flag; do
l)
THE_LANG="$OPTARG"
;;
+ H)
+ ALTERNATES="$OPTARG"
+ ;;
*)
exit 2
;;
@@ -29,6 +32,7 @@ assert_arg() {
assert_arg "${PROJECT_UC:-}" '-N PROJECT_UC'
assert_arg "${TITLE:-}" '-t TITLE'
assert_arg "${THE_LANG:-}" '-l THE_LANG'
+assert_arg "${ALTERNATES:-}" '-H ALTERNATES'
pandoc \
--toc \
@@ -39,4 +43,6 @@ pandoc \
--metadata "lang=$THE_LANG" \
-r commonmark \
-w html \
- -H aux/workflow/favicon.html
+ -H aux/workflow/favicon.html \
+ -H aux/workflow/style.css \
+ -H "$ALTERNATES"
diff --git a/aux/workflow/dist.sh b/aux/workflow/dist.sh
index a433478..68f8849 100755
--- a/aux/workflow/dist.sh
+++ b/aux/workflow/dist.sh
@@ -53,6 +53,12 @@ if git show "$VVERSION" 1>/dev/null 2>/dev/null; then
exit 1
fi
+if [ "v$(awk '/^VERSION *=/{print $3; exit}' Makefile)" != "$VVERSION" ]; then
+ echo "Version '$VVERSION' mismatch with \$(VERSION) in Makefile." >&2
+ echo 'Make sure to invoke this script with "make dist".' >&2
+ exit 1
+fi
+
if ! printf '%s\n%s\n' "$(git tag)" "$VVERSION" | sort -nct. -k1 -k2 -k3; then
echo 'New tag is not bigger than existing ones.' >&2
exit 1
@@ -63,12 +69,19 @@ if [ "$DATE" != "$(git log -1 --format=%cd --date=short HEAD)" ]; then
exit 1
fi
+if [ "$(awk '/^DATE *=/{print $3; exit}' Makefile)" != "$DATE" ]; then
+ echo "Date '$DATE' mismatch with \$(DATE) in Makefile." >&2
+ echo 'Make sure to invoke this script with "make dist".' >&2
+ exit 1
+fi
+
if [ "Release $VVERSION" != "$(git log --format=%B -1 HEAD | head -n1)" ]; then
echo "Commit message isn't 'Release $VVERSION'." >&2
exit 1
fi
-make clean public dev-check EXTRA_VERSION="$VVERSION"
+make clean
+env ASSERT_NO_MISSING_TRANSLATIONS=1 make dev-check EXTRA_VERSION="$VVERSION"
if ! (git diff --quiet && git diff --quiet --staged); then
echo 'Dirty repository.'
diff --git a/aux/workflow/preamble.md b/aux/workflow/preamble.md
index ee32d58..a699d04 100644
--- a/aux/workflow/preamble.md
+++ b/aux/workflow/preamble.md
@@ -12,3 +12,5 @@ and see [existing discussions](https://lists.sr.ht/~euandreh/@MAILING_LIST@?sear
*Vi povas ankaŭ skribi esperante*.
+*Tu también puedes escribir en español*.
+
diff --git a/aux/workflow/public.sh b/aux/workflow/public.sh
index 38613de..2c8c36a 100755
--- a/aux/workflow/public.sh
+++ b/aux/workflow/public.sh
@@ -1,6 +1,9 @@
#!/bin/sh
set -eu
+TLD="$(cat aux/tld.txt)"
+. aux/lib.sh
+
PROJECT_UC=
while getopts 'n:N:m:o:l:' flag; do
case "$flag" in
@@ -39,6 +42,23 @@ assert_arg "${OUTDIR:-}" '-o OUTDIR'
assert_arg "${LANGS:-}" '-l LANGS'
PROJECT_UC="${PROJECT_UC:-$PROJECT}"
+
+alternates_for() {
+ ALTERNATES="$(mkstemp)"
+ lang="$1"
+ OUTNAME="$2"
+ for l in $LANGS; do
+ if [ "$l" = "$lang" ]; then
+ continue
+ fi
+ cat <<EOF >> "$ALTERNATES"
+<link rel="alternate" href="https://$TLD/$PROJECT/$l/$OUTNAME" hreflang="$l" />
+EOF
+ done
+ echo "$ALTERNATES"
+}
+
+
mkdir -p "$OUTDIR"
sh aux/workflow/TODOs.sh \
@@ -46,9 +66,13 @@ sh aux/workflow/TODOs.sh \
for lang in $LANGS; do
mkdir -p "$OUTDIR/$lang/"
- sh aux/workflow/commonmark.sh -N "$PROJECT" -t README -l "$lang" \
+ sh aux/workflow/commonmark.sh \
+ -N "$PROJECT" -l "$lang" -t README \
+ -H "$(alternates_for "$lang" '')" \
< "README.$lang.md" > "$OUTDIR/$lang/index.html"
- sh aux/workflow/commonmark.sh -N "$PROJECT" -t CHANGELOG -l "$lang" \
+ sh aux/workflow/commonmark.sh \
+ -N "$PROJECT" -l "$lang" -t CHANGELOG \
+ -H "$(alternates_for "$lang" 'CHANGELOG.html')" \
< "CHANGELOG.$lang.md" > "$OUTDIR/$lang/CHANGELOG.html"
ln -fs ../favicon.svg "$OUTDIR/$lang"
done
diff --git a/aux/workflow/style.css b/aux/workflow/style.css
index d72991e..99980aa 100644
--- a/aux/workflow/style.css
+++ b/aux/workflow/style.css
@@ -1,41 +1,78 @@
<style>
- hr {
- background-color: #ccc;
- }
-
- .header-anchor {
- opacity: 0.5;
- }
-
- .tag {
- font-family: monospace;
- font-size: 70%;
- background-color: lightgray;
- padding: 3px;
- border-radius: 5px;
- }
-
- .TODO {
- color: brown;
- }
-
- .DOING {
- color: yellowgreen;
- }
-
- .WAITING, .MEETING {
- color: orange;
- }
-
- .INACTIVE {
- color: gray;
- }
-
- .NEXT {
- color: red;
- }
-
- .CANCELLED, .DONE, .WONTFIX {
- color: green;
- }
+ body {
+ max-width: 800px;
+ margin: 0 auto 0 auto;
+ }
+
+ hr {
+ background-color: #ccc;
+ }
+
+ .header-anchor {
+ opacity: 0.5;
+ display: inline-block;
+ }
+
+ .tag {
+ font-family: monospace;
+ font-size: 70%;
+ background-color: lightgray;
+ color: black;
+ padding: 3px;
+ border-radius: 5px;
+ }
+
+ .TODO {
+ color: brown;
+ }
+
+ .DOING {
+ color: yellowgreen;
+ }
+
+ .WAITING, .MEETING {
+ color: orange;
+ }
+
+ .INACTIVE {
+ color: gray;
+ }
+
+ .NEXT {
+ color: red;
+ }
+
+ .CANCELLED, .DONE, .WONTFIX {
+ color: green;
+ }
+
+ pre, code {
+ background-color: #ddd;
+ border-radius: 5px;
+ padding: 5px;
+ }
+
+ pre > code {
+ overflow: auto;
+ white-space: pre;
+ }
+
+ @media(prefers-color-scheme: dark) {
+ :root {
+ color: white;
+ background-color: black;
+ }
+
+ a {
+ color: hsl(211, 100%, 60%);
+ }
+
+ a:visited {
+ color: hsl(242, 100%, 80%);
+ }
+
+ pre, code {
+ background-color: #222;
+ }
+ }
</style>