Generates all of the documentation for given packages and
        appends new tocrees to the index. All documentation pages will be under the
        set relative path.

        Args:
            packages (list(module)): A package or list of packages that contain submodules to document
            showprivate (bool): A flag for whether or not to display private members

        Returns:
            str: The new content to append to the index

def _DocPackageFromTop(self, packages, showprivate=False, showinh=False):
        """Generates all of the documentation for given packages and
        appends new tocrees to the index. All documentation pages will be under the
        set relative path.

        Args:
            packages (list(module)): A package or list of packages that contain submodules to document
            showprivate (bool): A flag for whether or not to display private members

        Returns:
            str: The new content to append to the index
        """
        appIndex = ''
        if not isinstance(packages, list):
            packages = [packages]

        if os.path.exists('content'):
            shutil.rmtree('content')
        os.makedirs('content')

        appIndex += r'''

.. toctree::
   :maxdepth: 5
   :hidden:
   :caption: %s:

''' % ('API Index')

        # Iterate over each package and generate appropriate pages
        for i in range(len(packages)):
            # The package to document and its path
            package = packages[i]
            try:
                name = package.__displayname__
            except AttributeError:
                name = package.__name__
            # Make sure paths are ready
            path = 'content/%s' % package.__name__
            if os.path.exists(path):
                shutil.rmtree(path)
            os.makedirs(path)

            # Check if there is top level documentation
            # if package.__doc__:
            # Get metadata
            meta = 'About %s\n%s\n' % (name, '='*len('About ' + name))
            author = getattr(package, "__author__", None)
            license = getattr(package, "__license__", None)
            copyright = getattr(package, "__copyright__", None)
            version = getattr(package, "__version__", None)
            if author: meta += '\n* Author: %s' % author
            if license: meta += '\n* License: %s' % license
            if copyright: meta += '\n* Copyright: %s' % copyright
            if version: meta += '\n* Version: %s' % version
            about = '%s/%s' % (path, 'index.rst')

            this_toc = r'''

.. toctree::
   :maxdepth: 5
   :caption: %s:
''' % (name)

            this_toc += self._MakePackagePages(package, showprivate=showprivate, showinh=showinh)
            this_toc = this_toc.replace('%s/' % path, '')

            with open(about, 'w') as f:
                f.write('%s\n\n' % meta)
                if package.__doc__:
                    f.write(package.__doc__)
                f.write(this_toc)

            appIndex += '\n   %s' % about

        # Return the new content to append
        return appIndex