Summary Files Commits Branches @commit @diff @stats
path: root / generate.sh
diff options
context:
space:
mode:
1 files changed, 0 insertions, 138 deletions
-rwxr-xr-xgenerate.sh138
diff --git a/generate.sh b/generate.sh
deleted file mode 100755
index a9efe8c..0000000
--- a/generate.sh
+++ /dev/null
@@ -1,138 +0,0 @@
-#!/bin/sh
-
-set -e
-
-: ${SRC:=$PWD/src}
-: ${DST:=./website}
-: ${URL:=https://syndamia.com}
-: ${AWK:="mawk"}
-
-: ${HEADER:=$PWD/meta/header.html}
-: ${FOOTER:=$PWD/meta/footer.html}
-: ${META:=$PWD/meta/meta.tsv}
-
-export SRC DST URL AWK HEADER FOOTER META
-
-NO_FIX=
-NO_META=
-NO_TINY=
-FORCE_GEN=
-HIGHLIGHT=
-while [ -n "$1" ]
-do
- case "$1" in
- (-x|--no_fix) NO_FIX=y ;;
- (-m|--no_meta) NO_META=y ;;
- (-t|--no_tiny) NO_TINY=y ;;
- (-f|--force) FORCE_GEN=y ;;
- (-hi|--highlight)
- if command -v highlight >/dev/null 2>&1
- then
- HIGHLIGHT="$(command -v highlight)"
- else
- echo 'Requested highlighting but could not find "highlight" command!'
- exit 1
- fi
- ;;
- (*) echo "Unknown argument '$1'!" ; exit 1 ;;
- esac
- shift
-done
-
-export HIGHLIGHT
-
-#== 0. Check for changes ==#
-
-if [ -z "$FORCE_GEN" ] \
- && [ -d "$DST" ] \
- && [ -f "$DST/.commit" ] \
- && command -v git >/dev/null 2>&1 \
- && [ -z "$(git status -s)" ] \
- && [ "$(cat "$DST"/.commit)" = "$(git rev-parse HEAD)" ]
-then
- echo "Output '$DST' is up to date with website source '$SRC'!"
- echo "Refusing to generate..."
- exit 0
-fi
-
-#== 1. Fix hardlinks ==#
-
-if [ -z "$NO_FIX" ]
-then
- while read -r folder
- do
- if [ -f "$folder.du" ] && [ ! "$folder.du" -ef "$folder/index.du" ]
- then
- rm "$folder/index.du" >/dev/null 2>&1
- ln "$folder.du" "$folder/index.du"
- fi
- done << EOF
-$(find "$SRC" -maxdepth 1 -type d)
-EOF
-
- if [ ! "src/favicon.ico" -ef "src/img/favicon.ico" ]
- then
- rm "src/favicon.ico" >/dev/null 2>&1
- ln "src/img/favicon.ico" "src/favicon.ico"
- fi
-
- echo "[1/4] Fixed folder/index.md hardlinks"
-else
- echo "[1/4] Skipping..."
-fi
-
-#== 2. Dunbar source to HTML ==#
-
-mkdir -p "$DST"
-rm -r "$DST"/* 2>/dev/null || true
-cp -a "$SRC/." "$DST"
-
-/bin/sh ./dunbar/dunbar_awk/dunbar.sh html \
- -i \
- -e ./ext/pagenav.awk -e ./ext/presentation.awk \
- -e ./ext/highlight.awk \
- ./ext/global.du \
- $(find "$DST" -type f -name "*.du")
-
-date '+%e.%m.%Y %H:%M:%S %Z' > "$DST"/.build
-
-echo "[2/4] Converted '$SRC' to dunbar in '$DST'"
-
-#== 3. Meta handling ==#
-
-if [ -z "$NO_META" ]
-then
- $AWK -f ./meta/meta.awk \
- -v date="$(date +%Y-%m-%d)" \
- $(find "$DST" -type f -name "*.html")
-
- if command -v git >/dev/null 2>&1
- then
- git rev-parse HEAD > "$DST"/.commit
- fi
-
- echo "[3/4] Added HTML header/footer, generated sitemap"
-else
- echo "[3/4] Skipping"
-fi
-
-#== 4. Tiny version, strip away styles and other stuff ==#
-
-if [ -z "$NO_TINY" ]
-then
- mkdir -p "$DST.tiny"
- rm -r "$DST.tiny"/* 2>/dev/null || true
- cp -a "$DST/." "$DST.tiny"
- rm -rf "$DST.tiny"/*.css "$DST.tiny"/fonts/
-
- sed -i \
- -e '/rel="stylesheet"/d' \
- -e '/<script/d' \
- -e '/id="settingsWrapper"/,/<\/nav>/d' \
- -e '/id="scrollBtn"/d' \
- $(find "$DST.tiny" -type f -name "*.html")
-
- echo "[4/4] Created tiny website in '$DST.tiny'"
-else
- echo "[4/4] Skipping..."
-fi