diff options
author | EuAndreh <eu@euandre.org> | 2023-04-09 18:59:09 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2023-04-09 19:05:39 -0300 |
commit | 19a8b995c59cce5315e1d121054f9c27aad5c960 (patch) | |
tree | f2c2d83751245004beed21b31d973c1d412cd026 /v2/src/bin/conf | |
parent | v2: CSS dark mode, including SVGs (diff) | |
download | euandre.org-19a8b995c59cce5315e1d121054f9c27aad5c960.tar.gz euandre.org-19a8b995c59cce5315e1d121054f9c27aad5c960.tar.xz |
v2: Support translated alternates in <nav>
Diffstat (limited to 'v2/src/bin/conf')
-rwxr-xr-x | v2/src/bin/conf | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/v2/src/bin/conf b/v2/src/bin/conf index 92ecc68..e4dba61 100755 --- a/v2/src/bin/conf +++ b/v2/src/bin/conf @@ -154,6 +154,20 @@ if [ -z "${title:-}" ]; then printf 'export title="%s"\n' "$(printf '%s' "$title" | shesc)" fi +if [ -r "$FILENAME".i18n ]; then + translations="$(cat <<-EOF + <ul class="translation-list"> + $(awk -F: '{ + "url-for " $2 | getline url + printf " <li><a href=\"%s\">%s</a></li>\n", + url, $1 + }' "$FILENAME".i18n) + </ul> + EOF + )" + printf 'export translations_html="%s"\n' "$(shesc "$translations")" +fi + if [ -n "${date:-}" ]; then date_iso="$(date -ud "${date:?}" -Is)" printf 'export date_iso="%s"\n' "$date_iso" @@ -178,8 +192,8 @@ if [ -n "${update:-}" ]; then fi -url_part="$(printf '%s' "${FILENAME%.*}.html" | sed "s|^$CONTENT_PREFIX/||")" -url="$(url-for "$url_part")" +url="$(url-for "$FILENAME")" +url_part="$(printf '%s' "$url" | sed 's|^/||')" title_uri="$(uri "$title")" printf 'export title_html="%s"\n' "$(printf '%s' "$title" | htmlesc | shesc)" |