5 NR == 1 { t = $0; next }
6 NR == 2 && $1 ~ "======" { next }
8 $1 == "Date:" { d = $2; for(i = 3 ; i <= NF ; i++) d = d " " $i; next }
9 $1 == "Author:" { a = $2; for(i = 3 ; i <= NF ; i++) a = a " " $i; next }
10 $1 == "version" || $1 == "Version" {next}
11 /^[ \t]*$/ { printf "%% %s\n%% %s\n%% %s\n", t, a, d; exit }
15 # update the date field of file $1
18 local t=$(git log -n 1 --format=%ct $x)
19 [[ -n "$t" ]] || t=$(stat -c %Y $x)
20 local d=$(LANG= date -d @$t +"%d %B %Y")
21 sed -i "s/^\( Date: *\).*/\1$d/" $x
24 # make the html file for $1
27 local h=${x%%.md}.html
28 { meta "$x"; sed 's/TABLE-OF-CONTENT-HERE//' "$x"; } |
29 pandoc --css doc.css -f markdown -t html5 --toc > "$h"