commit 2e8714b12567cdbd62fd97cb50861f125641ebc8 parent 15ac0bf416d377f11195c27e9f71717469770800 Author: zakaria <58356365+e-zk@users.noreply.github.com> Date: Tue, 2 Mar 2021 16:22:18 +1000 Add individual page script Diffstat:
A | page.sh | | | 23 | +++++++++++++++++++++++ |
1 file changed, 23 insertions(+), 0 deletions(-)
diff --git a/page.sh b/page.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +. ${XDG_CONFIG_HOME:-${HOME}/.config}/shite/common.rc + +gen_page() { + post_file="$1" + post_title="$2" + post_content="$(run_lowdown "$(cat "$post_file")")" + + printf '<!DOCTYPE html>\n' + printf '<html lang="en">\n' + gen_head "$post_file" "${post_title}" + printf '<body>\n' + gen_nav + printf '<main>\n' + printf '%s\n' "$post_content" + printf '</main>\n' + gen_footer "$post_file" + printf '</body>\n' + printf '</html>\n' +} + +gen_page "$1" "$3" > "$2"