aboutsummaryrefslogtreecommitdiff
path: root/src/development/frontmatter-env.sh
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2024-11-17 19:49:22 -0300
committerEuAndreh <eu@euandre.org>2024-11-17 19:49:22 -0300
commitdfa41b2af885e8b51327064d0789dd02f53f635a (patch)
tree02672eade66aa495a5644fdea0dd0571bca28acf /src/development/frontmatter-env.sh
parentrm -rf v2/ (diff)
downloadeuandre.org-dfa41b2af885e8b51327064d0789dd02f53f635a.tar.gz
euandre.org-dfa41b2af885e8b51327064d0789dd02f53f635a.tar.xz
rm- rf src/development/
Diffstat (limited to 'src/development/frontmatter-env.sh')
-rwxr-xr-xsrc/development/frontmatter-env.sh91
1 files changed, 0 insertions, 91 deletions
diff --git a/src/development/frontmatter-env.sh b/src/development/frontmatter-env.sh
deleted file mode 100755
index f79ad50..0000000
--- a/src/development/frontmatter-env.sh
+++ /dev/null
@@ -1,91 +0,0 @@
-#!/bin/sh
-set -eu
-. src/development/lib.sh
-
-usage() {
- cat <<-'EOF'
- Usage:
- frontmatter-env.sh < STDIN
- frontmatter-env.sh -h
- EOF
-}
-
-help() {
- cat <<-'EOF'
-
-
- Options:
- -h, --help
-
-
- Examples:
-
- FIXME:
-
- $ FIXME
- EOF
-}
-
-for flag in "$@"; do
- case "$flag" in
- --)
- break
- ;;
- --help)
- usage
- help
- exit
- ;;
- *)
- ;;
- esac
-done
-
-while getopts 'h' flag; do
- case "$flag" in
- h)
- usage
- help
- exit
- ;;
- *)
- usage >&2
- exit 2
- ;;
- esac
-done
-shift $((OPTIND - 1))
-
-DELIM="$(uuid)"
-awk -vDELIM="$DELIM" -vQUOTE="'" -F: '
- BEGIN {
- separator = 0
- }
-
- /^---$/ {
- separator++
- if (separator > 1) {
- exit
- } else {
- next
- }
- }
-
- /^$/ { next }
-
- {
- printf "%s=\"$(\n\tcat <<-%s%s%s\n\t\t", $1, QUOTE, DELIM, QUOTE
- base_index = 1
- offset = base_index + length($1) + length(": ")
-
- # printf "\t%s\n", substr($0, offset + quote, length($0) - offset - quote)
- # JEKYLL_COMPAT: quoted titles because of the frontmatter
- if ($3 != "") {
- quote = length("\"")
- printf "%s", substr($0, offset + quote, length($0) - offset - quote)
- } else {
- printf "%s", substr($0, offset)
- }
- printf "\n\t%s\n)\"\n\n", DELIM
- }
-'