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.do20
1 files changed, 18 insertions, 2 deletions
diff --git a/lists/default.md.do b/lists/default.md.do
index 94636df..daf7453 100644
--- a/lists/default.md.do
+++ b/lists/default.md.do
@@ -5,7 +5,7 @@ POSTS=()
5while read -r -d $'\0'; do 5while read -r -d $'\0'; do
6 post=$(realpath --relative-to=. "$REPLY") 6 post=$(realpath --relative-to=. "$REPLY")
7 POSTS+=("$post") 7 POSTS+=("$post")
8done < <(find "$2" -maxdepth 1 -mindepth 1 -not -name 'title' -print0 | sort -z) 8done < <(find "$2" -maxdepth 1 -mindepth 1 -not -name 'title' -not -name 'preview' -print0 | sort -z)
9 9
10for x in "${POSTS[@]}"; do 10for x in "${POSTS[@]}"; do
11 printf "%s\0%s\0" "$x" "${x%.md}.html" 11 printf "%s\0%s\0" "$x" "${x%.md}.html"
@@ -18,7 +18,23 @@ cat <<EOF
18 18
19EOF 19EOF
20 20
21POST_TITLES=()
21for x in "${POSTS[@]}"; do 22for x in "${POSTS[@]}"; do
22 title=$(pandoc -t json "$x" | ../build/extract-title.hs 2>&1 >/dev/null) 23 title=$(pandoc -t json "$x" | ../build/extract-title.hs 2>&1 >/dev/null)
23 printf "* [%s](%s)\n" "$title" "${x%.md}.html" 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
31prev_no=3
32if [[ ${#POSTS[@]} -gt $prev_no ]]; then
33 printf "* …\n" > "$2/preview"
34else
35 prev_no=${#POSTS[@]}
36fi
37
38for n in $(seq $prev_no -1 1); do
39 printf "* [%s](%s)\n" "${POST_TITLES[-$n]}" "${POSTS[-$n]%.md}.html" >"$2/preview"
24done 40done