diff options
author | EuAndreh <eu@euandre.org> | 2021-10-04 09:51:16 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2021-10-05 15:55:03 -0300 |
commit | d808811e1542517182d4ab4154d978d7e9fe3408 (patch) | |
tree | d25ecd24db98f67846829523c8144b4687645ec9 /aux/workflow/public.sh | |
parent | TODOs.md: Add #td-94511264-e301-be51-23e2-cf960dcd603d (diff) | |
download | euandre.org-d808811e1542517182d4ab4154d978d7e9fe3408.tar.gz euandre.org-d808811e1542517182d4ab4154d978d7e9fe3408.tar.xz |
aux/: Update
Diffstat (limited to '')
-rwxr-xr-x | aux/workflow/public.sh | 28 |
1 files changed, 26 insertions, 2 deletions
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 |