diff options
author | Viktor Kleen <viktor@kleen.org> | 2015-01-02 09:29:04 +0000 |
---|---|---|
committer | Viktor Kleen <viktor@kleen.org> | 2015-01-02 09:29:04 +0000 |
commit | f7d4ba2023ab18b9d7c5fad85cbb863c61e6272c (patch) | |
tree | 7ffe93f3629546f8a0cb4ca7c7c7ce70196e4387 /lists/default.md.do | |
download | dirty-haskell.org-f7d4ba2023ab18b9d7c5fad85cbb863c61e6272c.tar dirty-haskell.org-f7d4ba2023ab18b9d7c5fad85cbb863c61e6272c.tar.gz dirty-haskell.org-f7d4ba2023ab18b9d7c5fad85cbb863c61e6272c.tar.bz2 dirty-haskell.org-f7d4ba2023ab18b9d7c5fad85cbb863c61e6272c.tar.xz dirty-haskell.org-f7d4ba2023ab18b9d7c5fad85cbb863c61e6272c.zip |
initial commit
Diffstat (limited to 'lists/default.md.do')
-rw-r--r-- | lists/default.md.do | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lists/default.md.do b/lists/default.md.do new file mode 100644 index 0000000..94636df --- /dev/null +++ b/lists/default.md.do | |||
@@ -0,0 +1,24 @@ | |||
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' -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 | for x in "${POSTS[@]}"; do | ||
22 | title=$(pandoc -t json "$x" | ../build/extract-title.hs 2>&1 >/dev/null) | ||
23 | printf "* [%s](%s)\n" "$title" "${x%.md}.html" | ||
24 | done | ||