o ×$•a ã@s‚dZddlmZmZmZddlmZddlmZddl m Z ddl m Z ddl mZGdd „d e ƒZd ed eeeffd d „ZdS)zÿ sphinx.environment.collectors.title ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The title collector components for sphinx.environment. :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. é)ÚAnyÚDictÚSet)Únodes)ÚSphinx)ÚBuildEnvironment)ÚEnvironmentCollector)ÚSphinxContentsFilterc @sdeZdZdZdedededdfdd„Zdeded eed eddf d d „Z ded e j ddfdd„Z dS)ÚTitleCollectorz'title collector for sphinx.environment.ÚappÚenvÚdocnameÚreturnNcCs |j |d¡|j |d¡dS©N)ÚtitlesÚpopÚ longtitles)Úselfr r r ©rúE/usr/lib/python3/dist-packages/sphinx/environment/collectors/title.pyÚ clear_docszTitleCollector.clear_docÚdocnamesÚothercCs.|D]}|j||j|<|j||j|<qdSr)rr)rr r rrr rrrÚ merge_othersþzTitleCollector.merge_otherÚdoctreecCsžt ¡}|}d|vrt ¡}|t |d¡7}| tj¡D]}t|ƒ}|d |¡|| ¡7}n |t | dd¡¡7}||j j |j j <||j j |j j <dS)zAdd a title node to the document (just copy the first section title), and store that title in the environment. Útitlerz N) rrÚTextÚtraverseÚsectionr Ú walkaboutÚget_entry_textÚgetr rr r)rr rÚ titlenodeÚ longtitlenodeÚnodeÚvisitorrrrÚ process_doc"s zTitleCollector.process_doc) Ú__name__Ú __module__Ú __qualname__Ú__doc__rrÚstrrrrrÚdocumentr&rrrrr s ÿÿ ÿr r rcCs| t¡ddddœS)NÚbuiltinT)ÚversionÚparallel_read_safeÚparallel_write_safe)Úadd_env_collectorr )r rrrÚsetup:s ýr2N)r*ÚtypingrrrÚdocutilsrÚsphinx.applicationrÚsphinx.environmentrÚsphinx.environment.collectorsrÚsphinx.transformsr r r+r2rrrrÚs     %