| 1 | !! |
| 2 | $DPP "Bun Blog" "Welcome to the Bun Blog" <template/head.html # > |
| 3 | $DPP blog <template/bar.html # > |
| 4 | |
| 5 | strip() { |
| 6 | temp="${@#\"}" |
| 7 | temp="${temp%\"}" |
| 8 | printf '%s\n' "$temp" |
| 9 | } |
| 10 | |
| 11 | for post in blog/*; do |
| 12 | [ ! -d "$post" ] && continue |
| 13 | [ ! -e "$post/index.html" ] && continue |
| 14 | |
| 15 | title="" |
| 16 | date="" |
| 17 | |
| 18 | count=0 |
| 19 | while IFS='=' read -r key val; do |
| 20 | [ $count -eq 2 ] && break |
| 21 | count=$((count + 1)) |
| 22 | |
| 23 | key="${key#\!\!}" |
| 24 | case "$key" in |
| 25 | title) title="$(strip "$val")" ;; |
| 26 | date) date="$(strip "$val")" ;; |
| 27 | esac |
| 28 | done <"$post/index.html" # > |
| 29 | |
| 30 | printf '<p><a href="%s">%s</a> %s</p>\n' "${post##*/}" "$title" "$date" |
| 31 | done |
| 32 | !! |
| 33 | |
| 34 | |
| 35 | !!$DPP <template/foot.html # > |
| 36 | |