2012-05-03 13:40:35 +00:00
|
|
|
#!/usr/bin/env zsh
|
|
|
|
|
|
|
|
function writeTOC() {
|
2012-06-05 13:38:57 +00:00
|
|
|
|
2012-05-03 13:40:35 +00:00
|
|
|
cat <<END
|
|
|
|
> <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>
|
|
|
|
>
|
2012-05-11 14:53:51 +00:00
|
|
|
> * This will be replaced by the ToC
|
|
|
|
> {:toc}
|
2012-05-03 13:40:35 +00:00
|
|
|
>
|
|
|
|
END
|
|
|
|
|
2012-05-11 14:53:51 +00:00
|
|
|
}
|
2012-05-03 13:40:35 +00:00
|
|
|
|
2012-06-05 13:38:57 +00:00
|
|
|
cat config.ymd
|
2012-05-03 13:40:35 +00:00
|
|
|
|
2012-05-10 14:51:24 +00:00
|
|
|
writeTOC
|
2012-05-03 13:40:35 +00:00
|
|
|
|
|
|
|
cat <<END
|
|
|
|
|
|
|
|
enddiv
|
|
|
|
|
|
|
|
END
|
|
|
|
|
2012-05-03 16:09:00 +00:00
|
|
|
for fic in **/*.lhs(.N); do
|
2012-05-03 13:40:35 +00:00
|
|
|
contains_haskell=$(( $( egrep '^>' $fic | wc -l) > 0 ))
|
|
|
|
((contains_haskell)) && \
|
2012-06-10 22:34:44 +00:00
|
|
|
print -- "\n<hr/><a href=\"code/$fic\" class=\"cut\">Download the source code of this section → ${fic:h}/<strong>${fic:t}</strong></a>\n"
|
2012-05-03 13:40:35 +00:00
|
|
|
cat $fic
|
|
|
|
((contains_haskell)) && \
|
2012-06-10 22:34:44 +00:00
|
|
|
print -- "\n<a href=\"code/$fic\" class=\"cut\">Download the source code of this section → ${fic:h}/<strong>${fic:t}</strong> </a>\n"
|
2012-05-04 14:29:32 +00:00
|
|
|
done | perl -pe 'BEGIN{$/="";} s#((^>.*\n)+)#<div class="codehighlight">\n<code class="haskell">\n$1</code>\n</div>\n#mg' | perl -pe 's#^> ?##' | perl -pe 's/^ #/#/'
|