summaryrefslogtreecommitdiff
path: root/lists/default.md.do
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2015-08-03 17:43:40 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2015-08-03 17:43:40 +0200
commit52b67951f1e8a7f1af9b85d4ae8e7689d194574a (patch)
tree88076113c7020e8483e5f47afa618d6449034f7e /lists/default.md.do
parent230688a0b842cf57b316a7ba62910ca387afbce7 (diff)
downloaddirty-haskell.org-52b67951f1e8a7f1af9b85d4ae8e7689d194574a.tar
dirty-haskell.org-52b67951f1e8a7f1af9b85d4ae8e7689d194574a.tar.gz
dirty-haskell.org-52b67951f1e8a7f1af9b85d4ae8e7689d194574a.tar.bz2
dirty-haskell.org-52b67951f1e8a7f1af9b85d4ae8e7689d194574a.tar.xz
dirty-haskell.org-52b67951f1e8a7f1af9b85d4ae8e7689d194574a.zip
Working prototype in hakyll
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