Fix bug with caption generation within table instead of level 1 header

Ping @andredias! :)
Just want to say "thanks" to you for your great utility. I made some bugfixes (see the PR's title), but, since I am not an Mercurial user (and not an active Bitbucket user), I have cloned and transformed your hg repo into git one. Feel free to apply [this patch](https://github.com/neoascetic/rst2html5/pull/1.patch) to the original repo.