aboutsummaryrefslogtreecommitdiff
path: root/v2/src/development
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2022-09-02 12:05:06 -0300
committerEuAndreh <eu@euandre.org>2022-09-02 12:06:36 -0300
commit684d4fcd950d3164c9fac75d89d504b251dffe74 (patch)
tree5f4a1aaca8273086c6988fe6615f08c3b5ef10ec /v2/src/development
parentv2/: WIP rewrite using Make over Jekyll (diff)
downloadeuandre.org-684d4fcd950d3164c9fac75d89d504b251dffe74.tar.gz
euandre.org-684d4fcd950d3164c9fac75d89d504b251dffe74.tar.xz
Make `url-for` and `absolute` standalone executables
Diffstat (limited to '')
-rwxr-xr-xv2/src/development/genhtml.sh31
1 files changed, 11 insertions, 20 deletions
diff --git a/v2/src/development/genhtml.sh b/v2/src/development/genhtml.sh
index 953a80d..3f1bca6 100755
--- a/v2/src/development/genhtml.sh
+++ b/v2/src/development/genhtml.sh
@@ -12,7 +12,6 @@ set -eu
# - sitemap? How does it even work?
# - dark mode
# - generate security.txt dynamically
-# - make url_for a standalone executable
# - config.env should depend on dynamic.mk?
@@ -91,14 +90,6 @@ eval "$(assert-arg "$FILENAME" 'FILENAME')"
# Utility functions
#
-url_for() {
- printf '%s/%s' "$BASE_URL" "$1"
-}
-
-absolute() {
- printf 'https://%s%s' "$FQDN" "$(cat)"
-}
-
translate() {
printf '%s' "$1"
}
@@ -166,7 +157,7 @@ extract_plaintext_snippets() {
printf '%s\n' "$line"
if [ "$line" = '</code></pre>' ]; then
- printf '<p class="plaintext-link"><a href="%s.%s.txt">plaintext</a></p>\n' "$(url_for "$URL")" "$BLOCK_NUMBER"
+ printf '<p class="plaintext-link"><a href="%s.%s.txt">plaintext</a></p>\n' "$(url-for "$URL")" "$BLOCK_NUMBER"
BLOCK_NUMBER=$((BLOCK_NUMBER + 1))
fi
done < "$F"
@@ -218,7 +209,7 @@ add_headings_anchors() {
"$SLUG" \
"$HEADING" \
"$SLUG" \
- "$(url_for 'static/link.svg')" \
+ "$(url-for 'static/link.svg')" \
"$LVL"
done
)
@@ -275,8 +266,8 @@ cat <<-EOF
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
- <link rel="stylesheet" type="text/css" href="$(url_for 'static/styles.css')" />
- <link rel="icon" type="image/svg+xml" href="$(url_for 'static/favicon.svg')" />
+ <link rel="stylesheet" type="text/css" href="$(url-for 'static/styles.css')" />
+ <link rel="icon" type="image/svg+xml" href="$(url-for 'static/favicon.svg')" />
<title>$TITLE</title>
@@ -285,15 +276,15 @@ cat <<-EOF
<meta property="og:locale" content="$LANGUAGE" />
<meta property="og:title" content="$TITLE" />
- <link rel="canonical" href="$(url_for "$URL" | absolute)" />
- <meta property="og:url" content="$(url_for "$URL" | absolute)" />
+ <link rel="canonical" href="$(url-for "$URL" | absolute)" />
+ <meta property="og:url" content="$(url-for "$URL" | absolute)" />
</head>
<body>
<header>
<nav>
<ul>
- <a href="$(url_for "$LANGUAGE/")">$(_ 'EuAndreh')</a>
- <a href="$(url_for "$(_ 'about.html')")">$(_ 'About')</a>
+ <a href="$(url-for "$LANGUAGE/")">$(_ 'EuAndreh')</a>
+ <a href="$(url-for "$(_ 'about.html')")">$(_ 'About')</a>
</ul>
</nav>
<hr />
@@ -315,12 +306,12 @@ cat <<-EOF
<hr />
<ul>
<li>
- <img class="svg-icon" src="$(url_for 'static/envelope.svg')" alt="$(_ 'a envelope icon representing an email address')" />
+ <img class="svg-icon" src="$(url-for 'static/envelope.svg')" alt="$(_ 'a envelope icon representing an email address')" />
<a href="mailto:eu@euandre.org">eu@euandre.org</a>
</li>
<li>
- <img class="svg-icon" src="$(url_for 'static/lock.svg')" alt="$(_ 'a lock icon representing a GPG public key')" />
- <a href="$(url_for 'static/public.asc.txt')">81F90EC3CD356060</a>
+ <img class="svg-icon" src="$(url-for 'static/lock.svg')" alt="$(_ 'a lock icon representing a GPG public key')" />
+ <a href="$(url-for 'static/public.asc.txt')">81F90EC3CD356060</a>
</li>
</ul>
<p>