diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2015-08-03 17:43:40 +0200 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2015-08-03 17:43:40 +0200 |
commit | 52b67951f1e8a7f1af9b85d4ae8e7689d194574a (patch) | |
tree | 88076113c7020e8483e5f47afa618d6449034f7e /lists/default.md.do | |
parent | 230688a0b842cf57b316a7ba62910ca387afbce7 (diff) | |
download | dirty-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.do | 41 |
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 | ||
2 | redo-ifchange "$2/title" | ||
3 | |||
4 | POSTS=() | ||
5 | while read -r -d $'\0'; do | ||
6 | post=$(realpath --relative-to=. "$REPLY") | ||
7 | POSTS+=("$post") | ||
8 | done < <(find "$2" -maxdepth 1 -mindepth 1 -not -name 'title' -not -name 'preview' -print0 | sort -z) | ||
9 | |||
10 | for x in "${POSTS[@]}"; do | ||
11 | printf "%s\0%s\0" "$x" "${x%.md}.html" | ||
12 | done | xargs -r -0 redo-ifchange | ||
13 | |||
14 | TITLE=$(< $2/title) | ||
15 | |||
16 | cat <<EOF | ||
17 | % $(< "$2/title") | ||
18 | |||
19 | EOF | ||
20 | |||
21 | POST_TITLES=() | ||
22 | for x in "${POSTS[@]}"; do | ||
23 | title=$(pandoc -t json "$x" | ../build/extract-title.hs) | ||
24 | POST_TITLES+=("$title") | ||
25 | done | ||
26 | |||
27 | for n in $(seq 0 $((${#POSTS[@]}-1))); do | ||
28 | printf "* [%s](%s)\n" "${POST_TITLES[$n]}" "${POSTS[$n]%.md}.html" | ||
29 | done | ||
30 | |||
31 | >"$2/preview" | ||
32 | prev_no=3 | ||
33 | if [[ ${#POSTS[@]} -gt $prev_no ]]; then | ||
34 | printf "* …\n" >> "$2/preview" | ||
35 | else | ||
36 | prev_no=${#POSTS[@]} | ||
37 | fi | ||
38 | |||
39 | for n in $(seq $prev_no -1 1); do | ||
40 | printf "* [%s](%s)\n" "${POST_TITLES[-$n]}" "${POSTS[-$n]%.md}.html" >>"$2/preview" | ||
41 | done | ||