diff options
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 |