code: def _DocPackageFromTop(self, packages, showprivate=False, showinh=False):
          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')
          for i in range(len(packages)):
              package = packages[i]
              try:
                  name = package.__displayname__
              except AttributeError:
                  name = package.__name__
              path = 'content/%s' % package.__name__
              if os.path.exists(path):
                  shutil.rmtree(path)
              os.makedirs(path)
              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 appIndex