#!/bin/sh recursivebuild() { local destdir=$(echo "$1" | sed 's|^src|http|') mkdir -p "$destdir" for file in "$1"/*; do if [ -d "$file" ]; then mkdir -p "$destdir/$(basename "$file")" recursivebuild "$file" else copyfile "$file" "$destdir" fi done } copyfile() { file=$1 dest=$2 ind=$dest/index.html extension=$(echo "$file" | sed 's/.*\.//') case "$extension" in md) t="$(markdowntitle "$file")" sed "s/TITLE/$t/" < top.html > "$ind" lowdown "$file" >> "$ind" cat bottom.html >> "$ind" ;; html) t="$(htmltitle "$file")" cat top.html "$file" bottom.html | sed "s/TITLE/$t/" > "$ind" ;; *) cp "$file" "$dest/$(basename "$file")" esac } markdowntitle() { grep '^# ' "$1" | head -n 1 | sed 's/^# //' } htmltitle() { grep '$//' } makeblogindexandfeed() { mkdir -p http/blog bf=http/blog/index.html ff=http/blog/feed.xml sed "s/TITLE/Blog/" < top.html > "$bf" { echo '
$thisyear | |
| $d | "; echo "$t |