forked from yogsototh/learn_haskell
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcreate_ymd.sh
executable file
·62 lines (50 loc) · 1.71 KB
/
create_ymd.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env zsh
cat <<END
-----
isHidden: false
menupriority: 1
kind: article
created_at: 2012-02-08T15:17:53+02:00
en: title: Learn Haskell Fast and Hard
en: subtitle: Blow your mind with Haskell
fr: title: Haskell comme un vrai!
fr: subtitle: Haskell à s'en faire griller les neurones
author_name: Yann Esposito
author_uri: yannesposito.com
tags:
- Haskell
- programming
- functional
- tutorial
-----
<%= blogimage("magritte_pleasure_principle.jpg","Magritte pleasure principle") %>
begindiv(intro)
en: <%= tldr %> A very short and dense tutorial for learning Haskell.
fr: <%= tlal %> Un tutoriel très court mais très dense pour apprendre Haskell.
> <center><hr style="width:30%;float:left;border-color:#CCCCD0;margin-top:1em"/><span class="sc"><b>Table of Content</b></span><hr style="width:30%;float:right;border-color:#CCCCD0;margin-top:1em"/></center>
>
> begindiv(toc)
>
END
# Create the TOC
# get a list of
# depth anchor name
grep -e '<h.' **/*.lhs | perl -pe 's#.*<h([2-6]) id="#\1 #;s#"[^>]*># "#; s#<.*#"#' |
while read num anchor title; do
echo -n '> '
while ((num-->2)); do echo -n " "; done
echo '* <a href="#'$anchor'">'${title[2,-2]}'</a>'
done
cat <<END
>
> enddiv
enddiv
END
for fic in **/*.lhs; do
contains_haskell=$(( $( egrep '^>' $fic | wc -l) > 0 ))
((contains_haskell)) && \
echo "\n<hr/><a href=\"code/$fic\" class=\"cut\">${fic:h}/<strong>${fic:t}</strong></a>\n"
cat $fic
((contains_haskell)) && \
echo "\n<a href=\"code/$fic\" class=\"cut\">${fic:h}/<strong>${fic:t}</strong> </a>\n"
done | perl -pe 'BEGIN{$/="";} s#((^>.*\n)+)#<div class="codehighlight">\n<code class="haskell">\n$1</code>\n</div>#mg' | perl -pe 's#^> ?##'