~darklands/teal

355ae2ccec2e02ee53298a4d8b907168930818a0 — Ben O'Neill 1 year, 5 months ago 0c1fa77
More updates on teal
3 files changed, 17 insertions(+), 14 deletions(-)

A example/index.sh
A example/otherpage.sh
M teal
A example/index.sh => example/index.sh +1 -0
@@ 0,0 1,1 @@
NAME="Home"

A example/otherpage.sh => example/otherpage.sh +1 -0
@@ 0,0 1,1 @@
NAME="Other Page"

M teal => teal +15 -14
@@ 13,7 13,7 @@ EOF
}

teal_head() { \
	name=$(echo $1 | sed 's/.html//' | awk -F"/" '{OFS="/"; print $NF}')
	. $2
	cat > $1 << EOF
<html>
<head>


@@ 25,7 25,7 @@ teal_head() { \
<meta content="width=device-width" name="viewport" />
<meta content="$KEYWORDS" name="keywords" />
<meta content="$DESCRIPTION" name="description" />
<title>$name - $TITLE</title>
<title>$NAME - $TITLE</title>
<link rel="stylesheet" href="style.css">
</head>
<body>


@@ 34,22 34,22 @@ EOF
}

teal_sidebar() { \
cat >> $1 << EOF
	cat >> $1 << EOF
<div id="side-bar">
<span>
<a href="index.html">home</a>
EOF
	for f in $EXTRA_PAGES; do
		cat >> $1 << EOF
<a href="$f.html">$f</a>
<a href="$f.html">$(echo $f | head -c 1 | tr '[:lower:]' '[:upper:]')$(echo $f | head -c -1)</a>
EOF
	done
	for file in $(find "$SRC" | grep ".md" | sed "/index.md/d;/^$/d" | sort); do
	for file in $(echo $SOURCES | tr ' ' '\n' | sed "s|^|$SRC/|"); do
		. $(echo $file | sed 's/md$/sh/')
		cat >> $1 << EOF
<a href="$(echo $file | sed "s,$SRC/,,;s/\.md/\.html/")">$(echo $file | sed "s,$SRC/,,;s/.md//")</a>
<a href="$(echo $file | sed "s,$SRC/,,;s/\.md/\.html/")">$NAME</a>
EOF
	done
cat >> $1 << EOF
	cat >> $1 << EOF
</span>
</div>
</div>


@@ 87,18 87,19 @@ teal_loop() { \
	cp -f style.css $TARGET

	# remove the source files
	for f in $(find $TARGET | grep .md); do
	for f in $(find $TARGET | egrep '(md)|(sh)$'); do
		rm -f $f
	done

	for f in $(find $SRC | grep .md); do
		out="$TARGET/$(echo $f | sed "s/\.md/\.html/;s,$SRC/,,;/^$/d")"
		teal_head $out
	for f in $SOURCES; do
		settings="$SRC/$(echo $f | sed "s/\.md/\.sh/;/^$/d")"
		out="$TARGET/$(echo $f | sed "s/\.md/\.html/;/^$/d")"
		teal_head $out $settings
		teal_header $out
		teal_sidebar $out
		teal_compile $f $out
		teal_compile "$SRC/$f" $out
		[ ! -z "$FOOTER" ] && teal_footer $out
		teal_end $out
		teal_end $out $settings
	done
}