aboutsummaryrefslogtreecommitdiff
path: root/v2/src/development
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xv2/src/development/genhtml.sh92
-rwxr-xr-xv2/src/development/getconf.sh21
2 files changed, 17 insertions, 96 deletions
diff --git a/v2/src/development/genhtml.sh b/v2/src/development/genhtml.sh
index 6839d23..8950b1d 100755
--- a/v2/src/development/genhtml.sh
+++ b/v2/src/development/genhtml.sh
@@ -193,93 +193,5 @@ emit_body() {
add_headings_anchors
}
-if false; then
- emit_body
-fi
-
-
-
-#
-# Main: generate the HTML to STDOUT.
-#
-
-cat <<-EOF
- <!DOCTYPE html>
- <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="${style_url:?}" />
- <link rel="icon" type="image/svg+xml" href="${favicon_url:?}" />
-
- <title>$$title_html</title>
-
- <meta name="author" content="EuAndreh" />
- <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:?}" />
- <meta property="og:url" content="${url:?}" />
- </head>
- <body>
- <header>
- <nav>
- <ul>
- <a href="$(url-for "$lang/")">EuAndreh</a>
- <a href="$(url-for 'about.html')">About</a>
- </ul>
- </nav>
- <hr />
- </header>
- <main>
- <article>
- \$(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
-# <a href="https://lists.sr.ht/~euandreh/public-inbox?search=$URI_TITLE">existing discussions</a>
-# |
-# <a href="https://euandre.org/git/euandre.org/tree/$FILENAME">view source</a>
-# </p>
-# </article>
-# </main>
-# <footer>
-# <hr />
-# <ul>
-# <li>
-# <img class="svg-icon" src="$(url-for 'static/envelope.svg')" alt="a envelope icon representing an email address" />
-# <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" />
-# <a href="$(url-for 'static/public.asc.txt')">81F90EC3CD356060</a>
-# </li>
-# </ul>
-# <p>
-# The content for this site is licensed under <a rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/">CC BY-SA 4.0</a>. The <a href="https://euandre.org/git/euandre.org">code</a> is <a rel="license" href="https://euandre.org/git/euandre.org/tree/COPYING">AGPLv3 or later</a>. Patches welcome.
-# </p>
-# </footer>
-# </body>
-# </html>
-# EOF
-
-# FIXMEs:
-# - feeds
-# - link to next and/or previous in <head>
-# - 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
+envsubst < src/lib/preamble.html
+envsubst < src/lib/postamble.html
diff --git a/v2/src/development/getconf.sh b/v2/src/development/getconf.sh
index 4b615a8..aa90706 100755
--- a/v2/src/development/getconf.sh
+++ b/v2/src/development/getconf.sh
@@ -99,23 +99,32 @@ escape() {
# shellcheck source=/dev/null
. src/lib/base."$lang".conf
- title="${title:-"$site_name"}"
+ if [ -z "${title:-}" ]; then
+ title="${site_name:?}"
+ printf 'title="%s"\n' "$(printf '%s' "$title" | escape)"
+ fi
+
+ if [ -z "${date:-}" ]; then
+ printf 'date_formatted="%s"\n' "$(LANG="$lang" date -d "${date:?}" +"${date_fmt:?}" | escape)"
+ fi
+
url_part="$(printf '%s' "${FILENAME%.md}.html" | sed 's|^src/content/||')"
- printf 'title="%s"\n' "$(printf '%s' "$title" | escape)"
printf 'title_html="%s"\n' "$(printf '%s' "$title" | htmlesc | escape)"
printf 'filename="%s"\n' "$FILENAME"
printf 'url_part="%s"\n' "$url_part"
printf 'url="%s"\n' "$(url-for "$url_part" | absolute)"
- printf 'date_formatted="%s"\n' "$(LANG="$lang" date -d "${date:?}" +"${date_fmt:?}" | escape)"
printf 'mailto_uri="%s%s"\n' "${mailto_uri_prefix:?}" "$(uri "$title")"
printf 'discussions_url="%s%s"\n' "${discussions_url_prefix:?}" "$(uri "$title")"
printf 'sourcecode_url="%s%s"\n' "${sourcecode_url_prefix:?}" "$FILENAME"
- printf 'lang_url="%s"\n' "$(url-for "$lang"/)"
+ printf 'style_url="%s"\n' "$(url-for -g 'style.css')"
+ printf 'favicon_url="%s"\n' "$(url-for -g 'favicon.svg')"
- printf 'style_url="%s"\n' "$(url-for 'style.css')"
- printf 'favicon_url="%s"\n' "$(url-for 'favicon.svg')"
+ # FIXME: special treatment of root
+ printf 'homepage_url="%s"\n' "$(url-for '/')"
+
+ printf 'about_url="%s"\n' "$(url-for "${about_url_name:?}")"
rm -f "$FILENAME".tmp
} | grep . | sed 's|^|export |'