summaryrefslogtreecommitdiff
path: root/lists/default.md.do
diff options
context:
space:
mode:
Diffstat (limited to 'lists/default.md.do')
-rw-r--r--lists/default.md.do41
1 files changed, 0 insertions, 41 deletions
diff --git a/lists/default.md.do b/lists/default.md.do
deleted file mode 100644
index 55abe6f..0000000
--- a/lists/default.md.do
+++ /dev/null
@@ -1,41 +0,0 @@
1#!/usr/bin/env bash
2redo-ifchange "$2/title"
3
4POSTS=()
5while read -r -d $'\0'; do
6 post=$(realpath --relative-to=. "$REPLY")
7 POSTS+=("$post")
8done < <(find "$2" -maxdepth 1 -mindepth 1 -not -name 'title' -not -name 'preview' -print0 | sort -z)
9
10for x in "${POSTS[@]}"; do
11 printf "%s\0%s\0" "$x" "${x%.md}.html"
12done | xargs -r -0 redo-ifchange
13
14TITLE=$(< $2/title)
15
16cat <<EOF
17% $(< "$2/title")
18
19EOF
20
21POST_TITLES=()
22for x in "${POSTS[@]}"; do
23 title=$(pandoc -t json "$x" | ../build/extract-title.hs)
24 POST_TITLES+=("$title")
25done
26
27for n in $(seq 0 $((${#POSTS[@]}-1))); do
28 printf "* [%s](%s)\n" "${POST_TITLES[$n]}" "${POSTS[$n]%.md}.html"
29done
30
31>"$2/preview"
32prev_no=3
33if [[ ${#POSTS[@]} -gt $prev_no ]]; then
34 printf "* …\n" >> "$2/preview"
35else
36 prev_no=${#POSTS[@]}
37fi
38
39for n in $(seq $prev_no -1 1); do
40 printf "* [%s](%s)\n" "${POST_TITLES[-$n]}" "${POSTS[-$n]%.md}.html" >>"$2/preview"
41done