From 2b39175011422a0d8f96d7f598f46e2a781dd28f Mon Sep 17 00:00:00 2001 From: Steph Enders Date: Thu, 29 Feb 2024 09:31:15 -0500 Subject: Initial rework commit: Build Script POC and CSS done I've created the main CSS layout and a proof of concept for the build script: this will actually build any "done" _post/ file and generate it as a workable HTML file. However, no index file generate, rss, or gemini is implemented --- old/compile-md.sh | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100755 old/compile-md.sh (limited to 'old/compile-md.sh') diff --git a/old/compile-md.sh b/old/compile-md.sh new file mode 100755 index 0000000..e0277eb --- /dev/null +++ b/old/compile-md.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +set -ex + +if [ $# -ne 4 ]; then + echo "./compile-md.sh [page|blog] [title] [in.md] [out.html]" + exit 1 +fi + +ptype=$1 +title=$2 +in=$3 +out=$4 + +if [ $ptype == "blog" ]; then + cat templates/blog-header.html > $out +else + if [ $ptype == "page" ]; then + cat templates/page-header.html > $out + else + echo "Missing first parameter: [page|blog]" + exit 1 + 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 -f fencedcode -f autolink $in >> $out + +if [ $1 == "blog" ]; then + cat templates/blog-footer.html >> $out +else + cat templates/page-footer.html >> $out +fi + +# update tags that are external vs internal - assumes all internal links us relative routes +sed -E -i "s/()/\1 rel=\"external noopener noreferrer\" target=\"_blank\" \2/g" $out + +./tidy.sh $out -- cgit v1.2.3-54-g00ecf