diff options
Diffstat (limited to '')
-rwxr-xr-x | v2/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 |