class_docstr: title collector for sphinx.environment.
class_docstr_tok: ["title","collector","for","sphinx.environment","."]
docstr: Add a title node to the document (just copy the first section title),
  and store that title in the environment.
docstr_tok: ["Add","a","title","node","to","the","document","(","just","copy","the","first","section","title",")",",","and","store","that","title","in","the","environment","."]
code: def process_doc(self, app: Sphinx, doctree: nodes.document) -> None:
      """Add a title node to the document (just copy the first section title),
      and store that title in the environment.
      """
      titlenode = nodes.title()
      longtitlenode = titlenode
      # explicit title set with title directive; use this only for
      # the <title> tag in HTML output
      if "title" in doctree:
          longtitlenode = nodes.title()
          longtitlenode += nodes.Text(doctree["title"])
      # look for first section title and use that as the title
      for node in doctree.findall(nodes.section):
          visitor = SphinxContentsFilter(doctree)
          node[0].walkabout(visitor)
          titlenode += visitor.get_entry_text()
          break
      else:
          # document has no title
          titlenode += nodes.Text(doctree.get("title", "<no title>"))
      app.env.titles[app.env.docname] = titlenode
      app.env.longtitles[app.env.docname] = longtitlenode
  
file_path: sphinx/sphinx/environment/collectors/title.py
imports: from __future__ import annotations
  from typing import TYPE_CHECKING, Any
  from docutils import nodes
  from sphinx.environment.collectors import EnvironmentCollector
  from sphinx.transforms import SphinxContentsFilter
label_desc: Use image node_id 3 for calling the TitleCollector obj's underlying member method code with example usage: obj.process_doc(app, doctree) without return types