#!/bin/bash
echo " <style> h2:before {content:none;}</style>
## 目次
<dl class=\"toc\">"
pdfgrep -n '(^第[0-9]章)|([0-9]\.){2,}|^参考|^謝辞|^付録' $1 |grep '^[0-9]*:[^ ]'|awk -F: '
{
if ($2 ~ /([0-9]\.){3}/) {
print "<div><dt class=\"depth-3\">",$2, "</dt><dd>",$1,"</dd></div>"
} else if ($2 ~ /([0-9]\.){2}/) {
print "<div><dt class=\"depth-2\">",$2, "</dt><dd>",$1,"</dd></div>"
} else {
print "<div><dt>",$2, "</dt><dd>",$1,"</dd></div>"
}
}'
echo '</dl>'