<commit_before>#!/bin/bash

function cleanUpHTML() {
	findfile -s ".html" . | while read -r P; do
		rm "$P"
	done
}

function FindNavMD() {
	DNAME="$1"
	if [ -f "${DNAME}/nav.md" ]; then
		echo "${DNAME}/nav.md"
		return
	fi
	DNAME=$(dirname "${DNAME}")
	FindNavMD "${DNAME}"
}

# Cleanup stale HTML files
cleanUpHTML

# Look through files and build new site
TITLE=""
if [[ "${1}" != "" ]]; then
	TITLE="${1}"
fi

mkpage "nav=nav.md" "content=README.md" page.tmpl >index.html
git add index.html

mkpage "nav=nav.md" "content=markdown:$(cat LICENSE)" page.tmpl >license.html
git add license.html

mkpage "nav=nav.md" "content=INSTALL.md" page.tmpl >install.html
git add install.html

findfile -s ".md" . | while read -r P; do
	DNAME="$(dirname "$P")"
	FNAME=$(basename "$P")
	PREFIX="${DNAME:0:4}"

	if [[ "${PREFIX}" == "dist" || "${PREFIX}" == "test" || "${FNAME}" == "nav.md" || "${FNAME}" == "README.md" || "${FNAME}" == "INSTALL.md" || "${FNAME}" == "TODO.md" || "${FNAME}" == "IDEAS.md" ]]; then
		echo "Skipping $P"
	else
		HTML_NAME="${DNAME}/$(basename "$FNAME" ".md").html"
		NAV=$(FindNavMD "$DNAME")
		echo "Building $HTML_NAME from $DNAME/$FNAME and $NAV"
		mkpage "title=text:${TITLE}" "nav=${NAV}" "content=${DNAME}/${FNAME}" page.tmpl >"${HTML_NAME}"
		git add "${HTML_NAME}"
	fi
done
<commit_msg>Quick Save<commit_after>#!/bin/bash

function cleanUpHTML() {
	findfile -s ".html" . | while read -r P; do
		rm "$P"
	done
}

function FindNavMD() {
	DNAME="$1"
	if [ -f "${DNAME}/nav.md" ]; then
		echo "${DNAME}/nav.md"
		return
	fi
	DNAME=$(dirname "${DNAME}")
	FindNavMD "${DNAME}"
}

# Cleanup stale HTML files
cleanUpHTML

# Look through files and build new site
TITLE=""
if [[ "${1}" != "" ]]; then
	TITLE="${1}"
fi

echo "Building index.html from README.md and nav.md"
mkpage "nav=nav.md" "content=README.md" page.tmpl >index.html
git add index.html

echo "Building license.html from LICENSE and nav.md"
mkpage "nav=nav.md" "content=markdown:$(cat LICENSE)" page.tmpl >license.html
git add license.html

echo "Building install.html from INSTALL.md and nav.md"
mkpage "nav=nav.md" "content=INSTALL.md" page.tmpl >install.html
git add install.html

findfile -s ".md" . | while read -r P; do
	DNAME="$(dirname "$P")"
	FNAME=$(basename "$P")
	PREFIX="${DNAME:0:4}"

	if [[ "${PREFIX}" == "dist" || "${PREFIX}" == "test" || "${FNAME}" == "nav.md" || "${FNAME}" == "README.md" || "${FNAME}" == "INSTALL.md" || "${FNAME}" == "TODO.md" || "${FNAME}" == "IDEAS.md" ]]; then
		# Skip render
        #echo "Skipping $P"
        echo -n ""
	else
		HTML_NAME="${DNAME}/$(basename "$FNAME" ".md").html"
		NAV=$(FindNavMD "$DNAME")
		echo "Building $HTML_NAME from $DNAME/$FNAME and $NAV"
		mkpage "title=text:${TITLE}" "nav=${NAV}" "content=${DNAME}/${FNAME}" page.tmpl >"${HTML_NAME}"
		git add "${HTML_NAME}"
	fi
done

{'fraction_non_alphanumeric': 0.22761061946902655, 'fraction_numerical': 0.0035398230088495575, 'mean_word_length': 4.292134831460674, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4353101', 'n_tokens_mistral': 1136, 'n_tokens_neox': 1094, 'n_words': 282}