# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
gendefault
etitle "Documentation de ulib"
array_from_lines ulibnames "$(list_files ulib)"
# faire les pages
for ulibname in "${ulibnames[@]}"; do
awkrun <"ulib/$ulibname" 'BEGIN {
in_func = 0
dump_doc = 0
dumped_doc = 0
print
}
!in_func && $0 ~ /^function / {
if (match($0, /function +([^ ]+)\(\)/, vs)) {
funcname = vs[1]
if (funcname !~ /^_/) {
in_func = 1
dump_doc = 1
dumped_doc = 0
print "==== " funcname " ===="
if ($0 ~ /}$/) {
in_func = 0
dump_doc = 0
dumped_doc = 0
}
next
}
}
}
in_func && dump_doc && $0 !~ /^ *#/ {
dump_doc = 0
}
in_func && dump_doc && $0 ~ /^ *#/ {
if (!dumped_doc) print ""
gsub(/^ *#+/, "")
print
dumped_doc = 1
}
in_func && $0 ~ /}$/ {
if (dumped_doc) print "
"
in_func = 0
dump_doc = 0
dumped_doc = 0
}
END { if (in_func) print "" }
' | setpage "$ulibname" ulib
done
eend
# faire l'entĂȘte
addpage start <