aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--v2/dynamic.mk2
-rwxr-xr-xv2/src/bin/extract22
-rw-r--r--v2/src/development/config.env.in1
-rwxr-xr-xv2/src/development/genhtml.sh29
4 files changed, 26 insertions, 28 deletions
diff --git a/v2/dynamic.mk b/v2/dynamic.mk
index b9cd5fc..8abb62e 100644
--- a/v2/dynamic.mk
+++ b/v2/dynamic.mk
@@ -46,7 +46,7 @@ ALL = \
all: $(ALL)
-$(html) src/bin/absolute src/bin/url-for: src/development/config.env
+$(html) src/bin/absolute src/bin/extract src/bin/url-for: src/development/config.env
$(html): src/development/genhtml.sh
diff --git a/v2/src/bin/extract b/v2/src/bin/extract
index 4380be7..a086264 100755
--- a/v2/src/bin/extract
+++ b/v2/src/bin/extract
@@ -87,6 +87,7 @@ case "$TYPE" in
' "$FILENAME"
;;
env)
+ cat src/development/config.env
awk '
/^---$/ {
if (++separator > 1) {
@@ -99,6 +100,27 @@ case "$TYPE" in
{ print }
' "$FILENAME"
printf "FILENAME='%s'\n" "$FILENAME"
+ cat <<-'REAL_EOF'
+ TITLE="${TITLE:-$SITE_NAME}"
+
+ URI_TITLE="$(printf '%s' "$TITLE" | uri)"
+
+ URL="$(
+ printf '%s' "$FILENAME" |
+ sed \
+ -e 's|^src/content/||' \
+ -e 's|md$|html|'
+ )"
+
+ PREAMBLE="$(cat <<EOF
+ # $TITLE
+
+ <p class="timestamp">
+ Posted on <time datetime="$DATE">$(LANG="$LANGUAGE" date -d "$DATE" "$DATE_FMT")</time>
+ </p>
+ EOF
+ )"
+ REAL_EOF
;;
*)
printf 'Bad value for TYPE: "%s".\n\n' \
diff --git a/v2/src/development/config.env.in b/v2/src/development/config.env.in
index 18d5367..ca2afe7 100644
--- a/v2/src/development/config.env.in
+++ b/v2/src/development/config.env.in
@@ -1,5 +1,6 @@
#!/bin/sh
+SITE_NAME="EuAndreh's website"
FQDN='@FQDN@'
BASE_URL='@BASE_URL@'
DATE_FMT='+%B %-d, %Y'
diff --git a/v2/src/development/genhtml.sh b/v2/src/development/genhtml.sh
index bcac28c..e4c6d1a 100755
--- a/v2/src/development/genhtml.sh
+++ b/v2/src/development/genhtml.sh
@@ -85,6 +85,8 @@ shift $((OPTIND - 1))
FILENAME="${1:-}"
eval "$(assert-arg "$FILENAME" 'FILENAME')"
+. "${FILENAME%.md}.entry-env"
+
#
# Utility functions
@@ -218,33 +220,6 @@ emit_body() {
}
-#
-# Environment variables
-#
-
-. src/development/config.env
-
-eval "$(
- awk '
- /^---$/ { if (++separator > 1) exit; else next; }
- { print }
- ' "$FILENAME"
-)"
-
-SITE_NAME="EuAndreh's website"
-TITLE="${TITLE:-$SITE_NAME}"
-URI_TITLE="$(printf '%s' "$TITLE" | uri)"
-URL="$(printf '%s' "$FILENAME" | sed -e 's|^src/content/||' -e 's|md$|html|')"
-
-PREAMBLE="$(
- cat <<-EOF
- # $TITLE
-
- <p class="timestamp">
- Posted on <time datetime="$DATE">$(LANG="$LANGUAGE" date -d "$DATE" "$DATE_FMT")</time>
- </p>
- EOF
-)"