aboutsummaryrefslogtreecommitdiff
path: root/v2/src/bin/html
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2023-04-05 16:14:00 -0300
committerEuAndreh <eu@euandre.org>2023-04-05 16:14:00 -0300
commit24e24b49fb6375189cfa527a113eb965087a293a (patch)
treefc75f8267a22f6473432ee6b07c4013561c303dc /v2/src/bin/html
parentv2: Recove h[2-6] anchor link and icon (diff)
downloadeuandre.org-24e24b49fb6375189cfa527a113eb965087a293a.tar.gz
euandre.org-24e24b49fb6375189cfa527a113eb965087a293a.tar.xz
v2: Support Atom feeds and collection translations
Diffstat (limited to '')
-rwxr-xr-xv2/src/bin/html (renamed from v2/src/development/genhtml.sh)21
1 files changed, 8 insertions, 13 deletions
diff --git a/v2/src/development/genhtml.sh b/v2/src/bin/html
index 1b2718a..7e6809c 100755
--- a/v2/src/development/genhtml.sh
+++ b/v2/src/bin/html
@@ -4,34 +4,29 @@ set -eu
usage() {
cat <<-'EOF'
Usage:
- genhtml.sh FILENAME
- genhtml.sh -h
+ html FILENAME
+ html -h
EOF
}
help() {
cat <<-'EOF'
+
Options:
-h, --help show this message
- FILENAME the name of the input file, to also be used as
- URL
+ FILENAME the name of the input file .md file
Process the FILENAME, and generate a full HTML page.
- The FILENAME is used to infer the output URL, by removing the
- `src/content/` prefix, and replacing the trailing `.md` with
- `.html`. This URL is used to build the self-referencing
- "canonical" link, extracting plaintext snippets, etc.
-
Examples:
Generate the HTML for a pastebin:
- $ sh genhtml.sh src/content/a-paste.md > src/content/a-paste.html
+ $ html src/a-paste.md > src/a-paste.html
EOF
}
@@ -66,7 +61,7 @@ while getopts 'h' flag; do
done
shift $((OPTIND - 1))
-. src/development/lib.sh
+. src/lib.sh
FILENAME="${1:-}"
eval "$(assert_arg "$FILENAME" 'FILENAME')"
@@ -118,7 +113,7 @@ markdown_to_html() {
extract_plaintext_snippets() {
SNIPPETS="${FILENAME%.md}.snippets"
- rm -f "$SNIPPETS"
+ printf '' > "$SNIPPETS"
F="$(mkstemp)"
cat > "$F"
(
@@ -220,5 +215,5 @@ emit_body() {
}
envsubst < src/lib/preamble.html
-emit_body
+emit_body | tee "${FILENAME%.md}.htmlbody"
envsubst < src/lib/postamble.html