Improve toc in ebook (Fixes #338, #322)