parameters: (self, sections)
return_statement: return self._template_renderer.Render(
          self._templates.GetFromFile(
              '%stable_of_contents.html' % PRIVATE_TEMPLATES).Get(),
          None,  # no request
          data_sources=('partials'),
          additional_context={'items': toc_items})
docstring: Renders a list of DocumentSections |sections| and returns a tuple
      (text, warnings).
docstring_summary: Renders a list of DocumentSections |sections| and returns a tuple
      (text, warnings).
docstring_tokens: Renders a list of DocumentSections |sections| and returns a tuple ( text warnings ) .
function: def Render(self, sections):
      '''Renders a list of DocumentSections |sections| and returns a tuple
      (text, warnings).
      '''
      path = '%stable_of_contents.html' % PRIVATE_TEMPLATES
      try:
        table_of_contents_template = self._templates.GetFromFile(path).Get()
      except FileNotFoundError:
        return '', ['%s not found' % path]
  
      def make_toc_items(entries):
        return [{
          'attributes':  [{'key': key, 'value': val}
                          for key, val in entry.attributes.iteritems()
                          if key != 'id'],
          'link':        entry.attributes.get('id', ''),
          'subheadings': make_toc_items(entry.entries),
          'title':       entry.name,
        } for entry in entries]
  
      toc_items = []
      for section in sections:
        items_for_section = make_toc_items(section.structure)
        if toc_items and items_for_section:
          items_for_section[0]['separator'] = True
        toc_items.extend(items_for_section)
  
      return self._template_renderer.Render(
          self._templates.GetFromFile(
              '%stable_of_contents.html' % PRIVATE_TEMPLATES).Get(),
          None,  # no request
          data_sources=('partials'),
          additional_context={'items': toc_items})
function_tokens: def Render ( self , sections ) : path = '%stable_of_contents.html' % PRIVATE_TEMPLATES try : table_of_contents_template = self . _templates . GetFromFile ( path ) . Get ( ) except FileNotFoundError : return '' , [ '%s not found' % path ] def make_toc_items ( entries ) : return [ { 'attributes' : [ { 'key' : key , 'value' : val } for key , val in entry . attributes . iteritems ( ) if key != 'id' ] , 'link' : entry . attributes . get ( 'id' , '' ) , 'subheadings' : make_toc_items ( entry . entries ) , 'title' : entry . name , } for entry in entries ] toc_items = [ ] for section in sections : items_for_section = make_toc_items ( section . structure ) if toc_items and items_for_section : items_for_section [ 0 ] [ 'separator' ] = True toc_items . extend ( items_for_section ) return self . _template_renderer . Render ( self . _templates . GetFromFile ( '%stable_of_contents.html' % PRIVATE_TEMPLATES ) . Get ( ) , None , # no request data_sources = ( 'partials' ) , additional_context = { 'items' : toc_items } )