def _build_toctree(self):
        """Create a hidden toctree node with the contents of a directory
        prefixed by the directory name specified by the `toctree` directive
        option.
        """
        dirname = posixpath.dirname(self._env.docname)
        tree_prefix = self.options['toctree'].strip()
        root = posixpath.normpath(posixpath.join(dirname, tree_prefix))
        docnames = [docname for docname in self._env.found_docs
                    if docname.startswith(root)]

        # Sort docnames alphabetically based on **class** name.
        # The standard we assume is that task doc pages are named after
        # their Python namespace.
        # NOTE: this ordering only applies to the toctree; the visual ordering
        # is set by `process_task_topic_list`.
        # NOTE: docnames are **always** POSIX-like paths
        class_names = [docname.split('/')[-1].split('.')[-1]
                       for docname in docnames]
        docnames = [docname for docname, _ in
                    sorted(zip(docnames, class_names),
                           key=lambda pair: pair[1])]

        tocnode = sphinx.addnodes.toctree()
        tocnode['includefiles'] = docnames
        tocnode['entries'] = [(None, docname) for docname in docnames]
        tocnode['maxdepth'] = -1
        tocnode['glob'] = None
        tocnode['hidden'] = True

        return tocnode
def _build_toctree ( self ) : dirname = posixpath . dirname ( self . _env . docname ) tree_prefix = self . options [ 'toctree' ] . strip ( ) root = posixpath . normpath ( posixpath . join ( dirname , tree_prefix ) ) docnames = [ docname for docname in self . _env . found_docs if docname . startswith ( root ) ] class_names = [ docname . split ( '/' ) [ - 1 ] . split ( '.' ) [ - 1 ] for docname in docnames ] docnames = [ docname for docname , _ in sorted ( zip ( docnames , class_names ) , key = lambda pair : pair [ 1 ] ) ] tocnode = sphinx . addnodes . toctree ( ) tocnode [ 'includefiles' ] = docnames tocnode [ 'entries' ] = [ ( None , docname ) for docname in docnames ] tocnode [ 'maxdepth' ] = - 1 tocnode [ 'glob' ] = None tocnode [ 'hidden' ] = True return tocnode
Create a hidden toctree node with the contents of a directory
        prefixed by the directory name specified by the `toctree` directive
        option.