class_docstr: Builder that outputs epub files.
  
  It creates the metainfo files container.opf, toc.ncx, mimetype, and
  META-INF/container.xml.  Afterwards, all necessary files are zipped to an
  epub file.
class_docstr_tok: ["Builder","that","outputs","epub","files",".","It","creates","the","metainfo","files","container.opf",",","toc.ncx",",","mimetype",",","and","META-INF\/container.xml",".","Afterwards",",","all","necessary","files","are","zipped","to","an","epub","file","."]
docstr: Collect section titles, their depth in the toc and the refuri.
code: def get_refnodes(
      self,
      doctree: Node,
      result: list[dict[str, Any]],
  ) -> list[dict[str, Any]]:
      """Collect section titles, their depth in the toc and the refuri."""
      # XXX: is there a better way than checking the attribute
      # toctree-l[1-8] on the parent node?
      if isinstance(doctree, nodes.reference) and doctree.get("refuri"):
          refuri = doctree["refuri"]
          if refuri.startswith(
              ("http://", "https://", "irc:", "mailto:")
          ):
              return result
          classes = doctree.parent.attributes["classes"]
          for level in range(8, 0, -1):  # or range(1, 8)?
              if (self.toctree_template % level) in classes:
                  result.append(
                      {
                          "level": level,
                          "refuri": html.escape(refuri),
                          "text": ssp(html.escape(doctree.astext())),
                      }
                  )
                  break
      elif isinstance(doctree, nodes.Element):
          for elem in doctree:
              result = self.get_refnodes(elem, result)
      return result
  
imports: from __future__ import annotations
  import html
  import os
  import re
  import time
  from os import path
  from typing import TYPE_CHECKING, Any, NamedTuple
  from urllib.parse import quote
  from zipfile import ZIP_DEFLATED, ZIP_STORED, ZipFile
  from docutils import nodes
  from docutils.utils import smartquotes
  from sphinx import addnodes
  from sphinx.builders.html import BuildInfo, StandaloneHTMLBuilder
  from sphinx.locale import __
  from sphinx.util import logging
  from sphinx.util.display import status_iterator
  from sphinx.util.fileutil import copy_asset_file
  from sphinx.util.osutil import copyfile, ensuredir, relpath
label_desc: Use image node_id 5 for calling the EpubBuilder obj's underlying member method code with example usage: obj.get_refnodes(doctree, result) and returns: result, result