6 <link rel="stylesheet" type="text/css" href="doc.css">
10 GENERATED-MARKDOWN-HERE
14 # substitute the pattern $1 by the content of the file $2
16 awk -v pat="$1" -v rep="$(sed 's:\\:\\\\:g' $2)" '{gsub(pat,rep);gsub(pat,"\\&");print}'
19 # update the date field of file $1
22 local t=$(git log -n 1 --format=%ct $x)
23 [[ -n "$t" ]] || t=$(stat -c %Y $x)
24 local d=$(LANG= date -d @$t +"%d %B %Y")
25 sed -i "s/^\( Date: *\).*/\1$d/" $x
28 # make the html file for $1
31 local h=${x%%.md}.html
32 expand -i $x | sed 's:^ : :' > $h.pre
33 markdown -f toc,autolink $h.pre > $h.toc.no
34 markdown -Tf toc,autolink $h.pre > $h.toc.yes
35 head --bytes=-$(stat -c %s $h.toc.no) $h.toc.yes > $h.toc
37 subst GENERATED-MARKDOWN-HERE $h.toc.no |
38 subst TABLE-OF-CONTENT-HERE $h.toc > $h