- shared_ptr<Toc> toc = backend.toc("child");
- docstring str = childbuffer->fileName().displayName();
- toc->push_back(TocItem(cpit, 0, str, output_active));
-
- //TocList & toclist = backend.tocs();
- childbuffer->tocBackend().update(output_active);
- TocList const & childtoclist = childbuffer->tocBackend().tocs();
- TocList::const_iterator it = childtoclist.begin();
- TocList::const_iterator const end = childtoclist.end();
- for(; it != end; ++it) {
- shared_ptr<Toc> toc = backend.toc(it->first);
- toc->insert(toc->end(), it->second->begin(), it->second->end());
+ // Include Tocs from children
+ childbuffer->tocBackend().update(output_active, utype);
+ for(auto const & pair : childbuffer->tocBackend().tocs()) {
+ string const & type = pair.first;
+ shared_ptr<Toc> child_toc = pair.second;
+ shared_ptr<Toc> toc = buffer().tocBackend().toc(type);
+ toc->insert(toc->end(), child_toc->begin(), child_toc->end());