aboutsummaryrefslogtreecommitdiff
path: root/v2/src/development/genhtml.sh
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xv2/src/development/genhtml.sh68
1 files changed, 39 insertions, 29 deletions
diff --git a/v2/src/development/genhtml.sh b/v2/src/development/genhtml.sh
index a1e8afb..cb8fd73 100755
--- a/v2/src/development/genhtml.sh
+++ b/v2/src/development/genhtml.sh
@@ -1,21 +1,6 @@
#!/bin/sh
set -eu
-# FIXMEs:
-# - feeds
-# - link to next and/or previous in <head>
-# - translation support
-# - validate input variables: regex for date (same as _plugins/linter.rb)
-# - `date -d` isn't POSIX
-# - parse commonmark and use a custom HTML emitter over <pre><code> regex
-# - handle mixture of personal scripts
-# - sitemap? How does it even work?
-# - dark mode
-# - generate security.txt dynamically
-# - config.env should depend on dynamic.mk?
-
-
-
usage() {
cat <<-'EOF'
Usage:
@@ -81,12 +66,13 @@ while getopts 'h' flag; do
done
shift $((OPTIND - 1))
+. src/development/lib.sh
FILENAME="${1:-}"
-eval "$(assert-arg "$FILENAME" 'FILENAME')"
+eval "$(assert_arg "$FILENAME" 'FILENAME')"
-. "${FILENAME%.md}.entry-env"
+. "${FILENAME%.md}.conf"
#
# Utility functions
@@ -216,28 +202,28 @@ emit_body() {
cat <<-EOF
<!DOCTYPE html>
- <html lang="$LANGUAGE">
+ <html lang="$lang">
<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="$style_url" />
+ <link rel="icon" type="image/svg+xml" href="$favicon_url" />
- <title>$TITLE</title>
+ <title>$$title_html</title>
<meta name="author" content="EuAndreh" />
- <meta property="og:site_name" content="$SITE_NAME" />
- <meta property="og:locale" content="$LANGUAGE" />
- <meta property="og:title" content="$TITLE" />
+ <meta property="og:site_name" content="$site_name" />
+ <meta property="og:locale" content="$lang" />
+ <meta property="og:title" content="$title_html" />
- <link rel="canonical" href="$(url-for "$URL" | absolute)" />
- <meta property="og:url" content="$(url-for "$URL" | absolute)" />
+ <link rel="canonical" href="$url" />
+ <meta property="og:url" content="$url" />
</head>
<body>
<header>
<nav>
<ul>
- <a href="$(url-for "$LANGUAGE/")">EuAndreh</a>
+ <a href="$(url-for "$lang/")">EuAndreh</a>
<a href="$(url-for 'about.html')">About</a>
</ul>
</nav>
@@ -245,8 +231,19 @@ cat <<-EOF
</header>
<main>
<article>
- $(emit_body)
+ \$(emit_body)
<hr />
+EOF
+exit
+
+
+.md.rehtml:
+ F="$<"; . "$${F%.md}.conf"; envsubst < src/lib/reamble."$$lang".html > $@
+
+.md.osthtml:
+ F="$<"; . "$${F%.md}.conf"; envsubst < src/lib/ostamble."$$lang".html > $@
+
+
<p class="post-footer">
<a href="mailto:~euandreh/public-inbox@lists.sr.ht?Subject=Re%3A%20$URI_TITLE">Comment</a>
and see
@@ -261,7 +258,7 @@ cat <<-EOF
<ul>
<li>
<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>
+ <a href="mailto:$email">$email</a>
</li>
<li>
<img class="svg-icon" src="$(url-for 'static/lock.svg')" alt="a lock icon representing a GPG public key" />
@@ -275,3 +272,16 @@ cat <<-EOF
</body>
</html>
EOF
+
+# FIXMEs:
+# - feeds
+# - link to next and/or previous in <head>
+# - translation support
+# - validate input variables: regex for date (same as _plugins/linter.rb)
+# - `date -d` isn't POSIX
+# - parse commonmark and use a custom HTML emitter over <pre><code> regex
+# - handle mixture of personal scripts
+# - sitemap? How does it even work?
+# - dark mode
+# - generate security.txt dynamically
+# - config.env should depend on dynamic.mk?