diff options
author | Bill <bill@billserver.senders.io> | 2022-11-04 16:32:52 -0400 |
---|---|---|
committer | Bill <bill@billserver.senders.io> | 2022-11-04 16:32:52 -0400 |
commit | da1be79522f7950bbe449f7c23c0f158a68bbdf4 (patch) | |
tree | e4c786660ef1936c40cb72966e9256e9d063f004 /compile-md.sh | |
parent | 65c5ad4194c5b89157a0d9b32d932695b7d0c747 (diff) | |
parent | c3e42f7851ce66af164621c7555021f1061bc286 (diff) |
Merge branch 'markdown-support' from bill
Diffstat (limited to 'compile-md.sh')
-rwxr-xr-x | compile-md.sh | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/compile-md.sh b/compile-md.sh index f79f742..c02e692 100755 --- a/compile-md.sh +++ b/compile-md.sh @@ -2,18 +2,20 @@ set -ex -if [ $# -ne 3 ]; then - echo "./compile-md.sh [page|blog] [in.md] [out.html]" +if [ $# -ne 4 ]; then + echo "./compile-md.sh [page|blog] [title] [in.md] [out.html]" exit 1 fi -in=$2 -out=$3 +ptype=$1 +title=$2 +in=$3 +out=$4 -if [ $1 == "blog" ]; then +if [ $ptype == "blog" ]; then cat templates/blog-header.html > $out else - if [ $1 == "page" ]; then + if [ $ptype == "page" ]; then cat templates/page-header.html > $out else echo "Missing first parameter: [page|blog]" @@ -21,6 +23,10 @@ else fi fi +pclass=$(echo "$title" | tr [:upper:] [:lower:]) +sed -i "s/PAGE_TITLE/$title/" $out # replace title +sed -i "s/PAGE_CLASS/$pclass/" $out # replace class + markdown $in >> $out if [ $1 == "blog" ]; then |