extract generator for table of contents into a separate class
reuse TocGenerator in reStructuredText contents directive